diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2012-12-30 16:25:48 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2012-12-30 16:25:48 +0000 |
commit | 98281a20503896349bd152e2dfe87435d3a6aada (patch) | |
tree | f4a6df704e5d899d63979d2b5203e06443e9cd85 /lib/Analysis | |
parent | 0d80c9c8c78279124bb0d7e275c2b634ca640fef (diff) | |
download | external_llvm-98281a20503896349bd152e2dfe87435d3a6aada.zip external_llvm-98281a20503896349bd152e2dfe87435d3a6aada.tar.gz external_llvm-98281a20503896349bd152e2dfe87435d3a6aada.tar.bz2 |
convert a bunch of callers from DataLayout::getIndexedOffset() to GEP::accumulateConstantOffset().
The later API is nicer than the former, and is correct regarding wrap-around offsets (if anyone cares).
There are a few more places left with duplicated code, which I'll remove soon.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171259 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/MemoryBuiltins.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Analysis/MemoryBuiltins.cpp b/lib/Analysis/MemoryBuiltins.cpp index 6fbb374..cfd8fcf 100644 --- a/lib/Analysis/MemoryBuiltins.cpp +++ b/lib/Analysis/MemoryBuiltins.cpp @@ -510,11 +510,10 @@ ObjectSizeOffsetVisitor::visitExtractValueInst(ExtractValueInst&) { SizeOffsetType ObjectSizeOffsetVisitor::visitGEPOperator(GEPOperator &GEP) { SizeOffsetType PtrData = compute(GEP.getPointerOperand()); - if (!bothKnown(PtrData) || !GEP.hasAllConstantIndices()) + APInt Offset(IntTyBits, 0); + if (!bothKnown(PtrData) || !GEP.accumulateConstantOffset(*TD, Offset)) return unknown(); - SmallVector<Value*, 8> Ops(GEP.idx_begin(), GEP.idx_end()); - APInt Offset(IntTyBits,TD->getIndexedOffset(GEP.getPointerOperandType(),Ops)); return std::make_pair(PtrData.first, PtrData.second + Offset); } |