Merge "Sanitize Module's target information."
diff --git a/lib/Core/Compiler.cpp b/lib/Core/Compiler.cpp
index a0fdb43..0c1ecd5 100644
--- a/lib/Core/Compiler.cpp
+++ b/lib/Core/Compiler.cpp
@@ -234,6 +234,10 @@
     return kErrInvalidSource;
   }
 
+  // Sanitize module's target information.
+  module.setTargetTriple(getTargetMachine().getTargetTriple());
+  module.setDataLayout(*getTargetMachine().getDataLayout());
+
   // Materialize the bitcode module.
   if (module.getMaterializer() != nullptr) {
     // A module with non-null materializer means that it is a lazy-load module.