aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/BasicAliasAnalysis.cpp
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2014-10-09 19:48:12 +0000
committerHal Finkel <hfinkel@anl.gov>2014-10-09 19:48:12 +0000
commitcbbd3df8361ba8907c6a66d367741e7a7813b361 (patch)
treea34cdb4baec0a444e7fedd42ac8df23da2852a69 /llvm/lib/Analysis/BasicAliasAnalysis.cpp
parent96039d727b3dfb190f23027aa62ec1718255ffa7 (diff)
downloadllvm-cbbd3df8361ba8907c6a66d367741e7a7813b361.zip
llvm-cbbd3df8361ba8907c6a66d367741e7a7813b361.tar.gz
llvm-cbbd3df8361ba8907c6a66d367741e7a7813b361.tar.bz2
Revert "[BasicAA] Revert "Revert r218714 - Make better use of zext and sign information.""
This reverts commit r219135 -- still causing miscompiles in SPEC it seems... llvm-svn: 219432
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/BasicAliasAnalysis.cpp43
1 files changed, 2 insertions, 41 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index 1a0a106..11b3332 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -254,10 +254,7 @@ static Value *GetLinearExpression(Value *V, APInt &Scale, APInt &Offset,
Value *Result = GetLinearExpression(CastOp, Scale, Offset, Extension,
DL, Depth+1, AT, DT);
Scale = Scale.zext(OldWidth);
-
- // We have to sign-extend even if Extension == EK_ZeroExt as we can't
- // decompose a sign extension (i.e. zext(x - 1) != zext(x) - zext(-1)).
- Offset = Offset.sext(OldWidth);
+ Offset = Offset.zext(OldWidth);
return Result;
}
@@ -1058,38 +1055,8 @@ BasicAliasAnalysis::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size,
// Grab the least significant bit set in any of the scales.
if (!GEP1VariableIndices.empty()) {
uint64_t Modulo = 0;
- bool AllPositive = true;
- for (unsigned i = 0, e = GEP1VariableIndices.size();
- i != e && AllPositive; ++i) {
- const Value *V = GEP1VariableIndices[i].V;
+ for (unsigned i = 0, e = GEP1VariableIndices.size(); i != e; ++i)
Modulo |= (uint64_t)GEP1VariableIndices[i].Scale;
-
- bool SignKnownZero, SignKnownOne;
- ComputeSignBit(
- const_cast<Value *>(V),
- SignKnownZero, SignKnownOne,
- DL, 0, AT, nullptr, DT);
-
- // Zero-extension widens the variable, and so forces the sign
- // bit to zero.
- bool IsZExt = GEP1VariableIndices[i].Extension == EK_ZeroExt;
- SignKnownZero |= IsZExt;
- SignKnownOne &= !IsZExt;
-
- // If the variable begins with a zero then we know it's
- // positive, regardless of whether the value is signed or
- // unsigned.
- int64_t Scale = GEP1VariableIndices[i].Scale;
- AllPositive &=
- (SignKnownZero && Scale >= 0) ||
- (SignKnownOne && Scale < 0);
-
- // If the Value is currently positive but could change in a cycle,
- // then we can't guarantee it'll always br positive.
- if (AllPositive && !isValueEqualInPotentialCycles(V, V))
- AllPositive = false;
- }
-
Modulo = Modulo ^ (Modulo & (Modulo - 1));
// We can compute the difference between the two addresses
@@ -1099,12 +1066,6 @@ BasicAliasAnalysis::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size,
if (V1Size != UnknownSize && V2Size != UnknownSize &&
ModOffset >= V2Size && V1Size <= Modulo - ModOffset)
return NoAlias;
-
- // If we know all the variables are positive, then GEP1 >= GEP1BasePtr.
- // If GEP1BasePtr > V2 (GEP1BaseOffset > 0) then we know the pointers
- // don't alias if V2Size can fit in the gap between V2 and GEP1BasePtr.
- if (AllPositive && GEP1BaseOffset > 0 && V2Size <= (uint64_t) GEP1BaseOffset)
- return NoAlias;
}
// Statically, we can see that the base objects are the same, but the