Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit d2c7e76

Browse files
committed
[BasicAliasAnalysis] Simplify expression, no functional change.
(-1) - x + 1 is the same as -x. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251185 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent a6f34a5 commit d2c7e76

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/Analysis/BasicAliasAnalysis.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,11 +1538,10 @@ bool BasicAAResult::constantOffsetHeuristic(
15381538

15391539
// If we've been sext'ed then zext'd the maximum difference between Var0 and
15401540
// Var1 is possible to calculate, but we're just interested in the absolute
1541-
// minumum difference between the two. The minimum distance may occur due to
1541+
// minimum difference between the two. The minimum distance may occur due to
15421542
// wrapping; consider "add i3 %i, 5": if %i == 7 then 7 + 5 mod 8 == 4, and so
15431543
// the minimum distance between %i and %i + 5 is 3.
1544-
APInt MinDiff = V0Offset - V1Offset,
1545-
Wrapped = APInt::getMaxValue(Width) - MinDiff + APInt(Width, 1);
1544+
APInt MinDiff = V0Offset - V1Offset, Wrapped = -MinDiff;
15461545
MinDiff = APIntOps::umin(MinDiff, Wrapped);
15471546
uint64_t MinDiffBytes = MinDiff.getZExtValue() * std::abs(Var0.Scale);
15481547

0 commit comments

Comments
 (0)