mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user