diff options
author | David Greene <greened@obbligato.org> | 2007-09-04 15:46:09 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2007-09-04 15:46:09 +0000 |
commit | b8f74793b9d161bc666fe27fc92fe112b6ec169b (patch) | |
tree | 3e79ac89138858c59c1f73af09b64527778ad944 /lib/Transforms/Scalar/LowerGC.cpp | |
parent | 382526239944023e435833ce759f536fec4e6225 (diff) |
Update GEP constructors to use an iterator interface to fix
GLIBCXX_DEBUG issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41697 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LowerGC.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LowerGC.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/LowerGC.cpp b/lib/Transforms/Scalar/LowerGC.cpp index 0da1d9199b..98070995af 100644 --- a/lib/Transforms/Scalar/LowerGC.cpp +++ b/lib/Transforms/Scalar/LowerGC.cpp @@ -242,8 +242,11 @@ bool LowerGC::runOnFunction(Function &F) { Constant *Zero = ConstantInt::get(Type::Int32Ty, 0); Constant *One = ConstantInt::get(Type::Int32Ty, 1); + Value *Idx[2] = { Zero, Zero }; + // Get a pointer to the prev pointer. - Value *PrevPtrPtr = new GetElementPtrInst(AI, Zero, Zero, "prevptrptr", IP); + Value *PrevPtrPtr = new GetElementPtrInst(AI, Idx, Idx + 2, + "prevptrptr", IP); // Load the previous pointer. Value *PrevPtr = new LoadInst(RootChain, "prevptr", IP); @@ -251,7 +254,9 @@ bool LowerGC::runOnFunction(Function &F) { new StoreInst(PrevPtr, PrevPtrPtr, IP); // Set the number of elements in this record. - Value *NumEltsPtr = new GetElementPtrInst(AI, Zero, One, "numeltsptr", IP); + Idx[1] = One; + Value *NumEltsPtr = new GetElementPtrInst(AI, Idx, Idx + 2, + "numeltsptr", IP); new StoreInst(ConstantInt::get(Type::Int32Ty, GCRoots.size()), NumEltsPtr,IP); Value* Par[4]; @@ -267,13 +272,15 @@ bool LowerGC::runOnFunction(Function &F) { // Initialize the meta-data pointer. Par[2] = ConstantInt::get(Type::Int32Ty, i); Par[3] = One; - Value *MetaDataPtr = new GetElementPtrInst(AI, Par, 4, "MetaDataPtr", IP); + Value *MetaDataPtr = new GetElementPtrInst(AI, Par, Par + 4, + "MetaDataPtr", IP); assert(isa<Constant>(GCRoots[i]->getOperand(2)) && "Must be a constant"); new StoreInst(GCRoots[i]->getOperand(2), MetaDataPtr, IP); // Initialize the root pointer to null on entry to the function. Par[3] = Zero; - Value *RootPtrPtr = new GetElementPtrInst(AI, Par, 4, "RootEntPtr", IP); + Value *RootPtrPtr = new GetElementPtrInst(AI, Par, Par + 4, + "RootEntPtr", IP); new StoreInst(Null, RootPtrPtr, IP); // Each occurrance of the llvm.gcroot intrinsic now turns into an |