Be sure to set the DataLayout before checking the cache.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 23 Jun 2015 14:42:34 +0000 (14:42 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 23 Jun 2015 14:42:34 +0000 (14:42 +0000)
This makes sure the same mangling is used.

Should fix the OS X bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240411 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/MCJIT/MCJIT.cpp

index 225188b3a89c6f0708602206247f7a361e0f01c4..a7d67050c7a68d35dc02c0b4193ed9818f0113a9 100644 (file)
@@ -147,8 +147,6 @@ std::unique_ptr<MemoryBuffer> MCJIT::emitObject(Module *M) {
 
   legacy::PassManager PM;
 
-  M->setDataLayout(*TM->getDataLayout());
-
   // The RuntimeDyld will take ownership of this shortly
   SmallVector<char, 4096> ObjBufferSV;
   raw_svector_ostream ObjStream(ObjBufferSV);
@@ -195,6 +193,8 @@ void MCJIT::generateCodeForModule(Module *M) {
   if (ObjCache)
     ObjectToLoad = ObjCache->getObject(M);
 
+  M->setDataLayout(*TM->getDataLayout());
+
   // If the cache did not contain a suitable object, compile the object
   if (!ObjectToLoad) {
     ObjectToLoad = emitObject(M);