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 | e6a7015ae97dd479c112bb8d55192975a02e3224 (patch) | |
| tree | 722c24519310eb9eaebd9dc45c575d97c971fe4d | |
| parent | feabd76dbb6dc3db73980cb1fd47c216cd117e10 (diff) | |
| download | external_llvm-e6a7015ae97dd479c112bb8d55192975a02e3224.zip external_llvm-e6a7015ae97dd479c112bb8d55192975a02e3224.tar.gz external_llvm-e6a7015ae97dd479c112bb8d55192975a02e3224.tar.bz2 | |
Make sure the initialization of a GC root is after its definition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101388 91177308-0d34-0410-b5e6-96231b3b80d8
| -rw-r--r-- | lib/CodeGen/GCStrategy.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/CodeGen/GCStrategy.cpp b/lib/CodeGen/GCStrategy.cpp index 6d7cc51..790cb21 100644 --- a/lib/CodeGen/GCStrategy.cpp +++ b/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; } |
