From d2c7e761d2699f8bd564744dee47ee3b8904bda7 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 24 Oct 2015 11:38:01 +0000 Subject: [PATCH] [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 --- lib/Analysis/BasicAliasAnalysis.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index 59b2953c3b9..bdefc1f3716 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -1538,11 +1538,10 @@ bool BasicAAResult::constantOffsetHeuristic( // 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); -- 2.11.0