diff options
author | Duncan Sands <baldrick@free.fr> | 2012-03-15 20:14:42 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2012-03-15 20:14:42 +0000 |
commit | f72e0ca71507ab3d8566148e124fe21f4a051cd1 (patch) | |
tree | 889f7df3e2a339357b60e1098d48412d4431cb85 /lib/Analysis/InstructionSimplify.cpp | |
parent | 45b5f88938f59c495209512b545f289bf2cca90a (diff) |
Type sizes and fields offsets inside structs are unsigned. This is a highly
theoretical fix since it only matters for types with >= 2^63 bits (!) and also
only matters if pointers have more than 64 bits, which is not supported anyway.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152831 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/InstructionSimplify.cpp')
-rw-r--r-- | lib/Analysis/InstructionSimplify.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp index b095bc4272..f8d159dc43 100644 --- a/lib/Analysis/InstructionSimplify.cpp +++ b/lib/Analysis/InstructionSimplify.cpp @@ -673,13 +673,11 @@ static bool accumulateGEPOffset(const TargetData &TD, GEPOperator *GEP, if (StructType *STy = dyn_cast<StructType>(*GTI)) { unsigned ElementIdx = OpC->getZExtValue(); const StructLayout *SL = TD.getStructLayout(STy); - Offset += APInt(IntPtrWidth, SL->getElementOffset(ElementIdx), - /*isSigned=*/true); + Offset += APInt(IntPtrWidth, SL->getElementOffset(ElementIdx)); continue; } - APInt TypeSize(IntPtrWidth, TD.getTypeAllocSize(GTI.getIndexedType()), - /*isSigned=*/true); + APInt TypeSize(IntPtrWidth, TD.getTypeAllocSize(GTI.getIndexedType())); Offset += OpC->getValue().sextOrTrunc(IntPtrWidth) * TypeSize; } return true; |