[llvm] r194831 - Don't try to initialize memory for a global if the allocation failed in ExecutionEngine.

Andrew Kaylor andrew.kaylor at intel.com
Fri Nov 15 09:52:54 PST 2013


Author: akaylor
Date: Fri Nov 15 11:52:54 2013
New Revision: 194831

URL: http://llvm.org/viewvc/llvm-project?rev=194831&view=rev
Log:
Don't try to initialize memory for a global if the allocation failed in ExecutionEngine.

Patch by Dale Martin!


Modified:
    llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp

Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=194831&r1=194830&r2=194831&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Fri Nov 15 11:52:54 2013
@@ -1289,6 +1289,10 @@ void ExecutionEngine::EmitGlobalVariable
   if (GA == 0) {
     // If it's not already specified, allocate memory for the global.
     GA = getMemoryForGV(GV);
+
+    // If we failed to allocate memory for this global, return.
+    if (GA == 0) return;
+
     addGlobalMapping(GV, GA);
   }
 





More information about the llvm-commits mailing list