[llvm-commits] [llvm] r101388 - /llvm/trunk/lib/CodeGen/GCStrategy.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Thu Apr 15 12:53:35 PDT 2010


Author: geoffray
Date: Thu Apr 15 14:53:35 2010
New Revision: 101388

URL: http://llvm.org/viewvc/llvm-project?rev=101388&view=rev
Log:
Make sure the initialization of a GC root is after its definition.


Modified:
    llvm/trunk/lib/CodeGen/GCStrategy.cpp

Modified: llvm/trunk/lib/CodeGen/GCStrategy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GCStrategy.cpp?rev=101388&r1=101387&r2=101388&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GCStrategy.cpp (original)
+++ llvm/trunk/lib/CodeGen/GCStrategy.cpp Thu Apr 15 14:53:35 2010
@@ -181,9 +181,10 @@
   
   for (AllocaInst **I = Roots, **E = Roots + Count; I != E; ++I)
     if (!InitedRoots.count(*I)) {
-      new StoreInst(ConstantPointerNull::get(cast<PointerType>(
-                      cast<PointerType>((*I)->getType())->getElementType())),
-                    *I, IP);
+      StoreInst* SI = new StoreInst(ConstantPointerNull::get(cast<PointerType>(
+                        cast<PointerType>((*I)->getType())->getElementType())),
+                        *I);
+      SI->insertAfter(*I);
       MadeChange = true;
     }
   





More information about the llvm-commits mailing list