[llvm] r278008 - [LVI] NFC. Rename confusing local NegOffset to Offset

Artur Pilipenko via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 07:13:56 PDT 2016


Author: apilipenko
Date: Mon Aug  8 09:13:56 2016
New Revision: 278008

URL: http://llvm.org/viewvc/llvm-project?rev=278008&view=rev
Log:
[LVI] NFC. Rename confusing local NegOffset to Offset

NegOffset is not necessarily negative

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

Modified: llvm/trunk/lib/Analysis/LazyValueInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyValueInfo.cpp?rev=278008&r1=278007&r2=278008&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LazyValueInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyValueInfo.cpp Mon Aug  8 09:13:56 2016
@@ -1199,20 +1199,20 @@ bool getValueFromCondition(Value *Val, V
     }
 
     // Recognize the range checking idiom that InstCombine produces.
-    // (X-C1) u< C2 --> [C1, C1+C2)
-    ConstantInt *NegOffset = nullptr;
+    // (X+C1) u< C2 --> [-C1, C2-C1)
+    ConstantInt *Offset = nullptr;
     if (Predicate == ICmpInst::ICMP_ULT)
-      match(LHS, m_Add(m_Specific(Val), m_ConstantInt(NegOffset)));
+      match(LHS, m_Add(m_Specific(Val), m_ConstantInt(Offset)));
 
     ConstantInt *CI = dyn_cast<ConstantInt>(RHS);
-    if (CI && (LHS == Val || NegOffset)) {
+    if (CI && (LHS == Val || Offset)) {
       // Calculate the range of values that are allowed by the comparison
       ConstantRange CmpRange(CI->getValue());
       ConstantRange TrueValues =
           ConstantRange::makeAllowedICmpRegion(Predicate, CmpRange);
 
-      if (NegOffset) // Apply the offset from above.
-        TrueValues = TrueValues.subtract(NegOffset->getValue());
+      if (Offset) // Apply the offset from above.
+        TrueValues = TrueValues.subtract(Offset->getValue());
 
       // If we're interested in the false dest, invert the condition.
       if (!isTrueDest) TrueValues = TrueValues.inverse();




More information about the llvm-commits mailing list