diff options
author | Nicolas Geoffray <nicolas.geoffray@lip6.fr> | 2010-04-15 19:53:35 +0000 |
---|---|---|
committer | Nicolas Geoffray <nicolas.geoffray@lip6.fr> | 2010-04-15 19:53:35 +0000 |
commit | 19cd1d84adae29e5c40c9ff2b63bae1e68977733 (patch) | |
tree | 843e889b9d9dbb842be1fc52aca25c5796f3533a /llvm/lib/CodeGen/GCStrategy.cpp | |
parent | 839cdaa70a2f4c36df0441bb7c467efeaa6f157b (diff) | |
download | bcm5719-llvm-19cd1d84adae29e5c40c9ff2b63bae1e68977733.tar.gz bcm5719-llvm-19cd1d84adae29e5c40c9ff2b63bae1e68977733.zip |
Make sure the initialization of a GC root is after its definition.
llvm-svn: 101388
Diffstat (limited to 'llvm/lib/CodeGen/GCStrategy.cpp')
-rw-r--r-- | llvm/lib/CodeGen/GCStrategy.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/GCStrategy.cpp b/llvm/lib/CodeGen/GCStrategy.cpp index 6d7cc51547d..790cb216489 100644 --- a/llvm/lib/CodeGen/GCStrategy.cpp +++ b/llvm/lib/CodeGen/GCStrategy.cpp @@ -181,9 +181,10 @@ bool LowerIntrinsics::InsertRootInitializers(Function &F, AllocaInst **Roots, 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; } |