summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-09-01 02:00:51 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-09-01 02:00:51 +0000
commitffac17a223386c7e68cb58422aa2891dbad1f5f7 (patch)
tree0e18c9edc4e112ee57f1f156d999bb2dd73562ca /llvm/lib/Transforms/Scalar
parent53cacaec46c50ee3a06cc324ad068355a654ce08 (diff)
downloadbcm5719-llvm-ffac17a223386c7e68cb58422aa2891dbad1f5f7.tar.gz
bcm5719-llvm-ffac17a223386c7e68cb58422aa2891dbad1f5f7.zip
Fix a gcroot lowering bug.
llvm-svn: 41668
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/LowerGC.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LowerGC.cpp b/llvm/lib/Transforms/Scalar/LowerGC.cpp
index e1576845dc2..0da1d9199ba 100644
--- a/llvm/lib/Transforms/Scalar/LowerGC.cpp
+++ b/llvm/lib/Transforms/Scalar/LowerGC.cpp
@@ -262,7 +262,7 @@ bool LowerGC::runOnFunction(Function &F) {
cast<PointerType>(GCRootInt->getFunctionType()->getParamType(0));
Constant *Null = ConstantPointerNull::get(PtrLocTy);
- // Initialize all of the gcroot records now, and eliminate them as we go.
+ // Initialize all of the gcroot records now.
for (unsigned i = 0, e = GCRoots.size(); i != e; ++i) {
// Initialize the meta-data pointer.
Par[2] = ConstantInt::get(Type::Int32Ty, i);
@@ -282,7 +282,6 @@ bool LowerGC::runOnFunction(Function &F) {
new StoreInst(Constant::getNullValue(PtrLocTy->getElementType()),
GCRoots[i]->getOperand(1), GCRoots[i]);
new StoreInst(GCRoots[i]->getOperand(1), RootPtrPtr, GCRoots[i]);
- GCRoots[i]->getParent()->getInstList().erase(GCRoots[i]);
}
// Now that the record is all initialized, store the pointer into the global
@@ -290,6 +289,10 @@ bool LowerGC::runOnFunction(Function &F) {
Value *C = new BitCastInst(AI, PointerType::get(MainRootRecordType), "", IP);
new StoreInst(C, RootChain, IP);
+ // Eliminate all the gcroot records now.
+ for (unsigned i = 0, e = GCRoots.size(); i != e; ++i)
+ GCRoots[i]->getParent()->getInstList().erase(GCRoots[i]);
+
// On exit from the function we have to remove the entry from the GC root
// chain. Doing this is straight-forward for return and unwind instructions:
// just insert the appropriate copy.
OpenPOWER on IntegriCloud