[llvm] r251185 - [BasicAliasAnalysis] Simplify expression, no functional change.

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 24 04:38:03 PDT 2015


Author: d0k
Date: Sat Oct 24 06:38:01 2015
New Revision: 251185

URL: http://llvm.org/viewvc/llvm-project?rev=251185&view=rev
Log:
[BasicAliasAnalysis] Simplify expression, no functional change.

(-1) - x + 1 is the same as -x.

Modified:
    llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp

Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=251185&r1=251184&r2=251185&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Sat Oct 24 06:38:01 2015
@@ -1538,11 +1538,10 @@ bool BasicAAResult::constantOffsetHeuris
 
   // If we've been sext'ed then zext'd the maximum difference between Var0 and
   // Var1 is possible to calculate, but we're just interested in the absolute
-  // minumum difference between the two. The minimum distance may occur due to
+  // minimum difference between the two. The minimum distance may occur due to
   // wrapping; consider "add i3 %i, 5": if %i == 7 then 7 + 5 mod 8 == 4, and so
   // the minimum distance between %i and %i + 5 is 3.
-  APInt MinDiff = V0Offset - V1Offset,
-        Wrapped = APInt::getMaxValue(Width) - MinDiff + APInt(Width, 1);
+  APInt MinDiff = V0Offset - V1Offset, Wrapped = -MinDiff;
   MinDiff = APIntOps::umin(MinDiff, Wrapped);
   uint64_t MinDiffBytes = MinDiff.getZExtValue() * std::abs(Var0.Scale);
 




More information about the llvm-commits mailing list