diff options
author | Anand Shukla <ashukla@cs.uiuc.edu> | 2002-06-25 21:07:58 +0000 |
---|---|---|
committer | Anand Shukla <ashukla@cs.uiuc.edu> | 2002-06-25 21:07:58 +0000 |
commit | 5ba99bd124dc18302f527d6e2b0efd0fa866bc9e (patch) | |
tree | bfb70cbcb3114ff4c8783c4632ac1232964006ff /lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp | |
parent | cfb22d3c14b53bc73ec90f7d471c2d2d2453cf03 (diff) |
changes to make it compatible with 64bit gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2792 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp')
-rw-r--r-- | lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp index ab6059a88f..b18095027b 100644 --- a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp +++ b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp @@ -66,6 +66,7 @@ bool DecomposePass::runOnBasicBlock(BasicBlock &BB) { // uses the last ptr2 generated in the loop and a single index. // If any index is (uint) 0, we omit the getElementPtr instruction. // + void DecomposePass::decomposeArrayRef(BasicBlock::iterator &BBI) { MemAccessInst &MAI = cast<MemAccessInst>(*BBI); BasicBlock *BB = MAI.getParent(); @@ -74,10 +75,11 @@ void DecomposePass::decomposeArrayRef(BasicBlock::iterator &BBI) { // Remove the instruction from the stream BB->getInstList().remove(BBI); - vector<Instruction*> NewInsts; + std::vector<Instruction*> NewInsts; // Process each index except the last one. // + User::const_op_iterator OI = MAI.idx_begin(), OE = MAI.idx_end(); for (; OI+1 != OE; ++OI) { assert(isa<PointerType>(LastPtr->getType())); @@ -92,8 +94,10 @@ void DecomposePass::decomposeArrayRef(BasicBlock::iterator &BBI) { // and the next index is a structure offset (i.e., not an array offset), // we need to include an initial [0] to index into the pointer. // - vector<Value*> Indices; + + std::vector<Value*> Indices; const PointerType *PtrTy = cast<PointerType>(LastPtr->getType()); + if (isa<StructType>(PtrTy->getElementType()) && !PtrTy->indexValid(*OI)) Indices.push_back(Constant::getNullValue(Type::UIntTy)); @@ -117,6 +121,7 @@ void DecomposePass::decomposeArrayRef(BasicBlock::iterator &BBI) { NewInsts.push_back(cast<Instruction>(LastPtr)); ++NumAdded; } + // Instruction 2: nextPtr2 = cast nextPtr1 to NextPtrTy // This is not needed if the two types are identical. @@ -134,7 +139,8 @@ void DecomposePass::decomposeArrayRef(BasicBlock::iterator &BBI) { const PointerType *PtrTy = cast<PointerType>(LastPtr->getType()); // First, get the final index vector. As above, we may need an initial [0]. - vector<Value*> Indices; + + std::vector<Value*> Indices; if (isa<StructType>(PtrTy->getElementType()) && !PtrTy->indexValid(*OI)) Indices.push_back(Constant::getNullValue(Type::UIntTy)); @@ -156,6 +162,7 @@ void DecomposePass::decomposeArrayRef(BasicBlock::iterator &BBI) { assert(0 && "Unrecognized memory access instruction"); } NewInsts.push_back(NewI); + // Replace all uses of the old instruction with the new MAI.replaceAllUsesWith(NewI); |