[llvm] b740899 - [Indvars][NFCI] Simplify assertion.

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 10:59:56 PDT 2020


Author: Benjamin Kramer
Date: 2020-10-16T19:58:55+02:00
New Revision: b740899c500ba6a707711b74bfdacf104e8a8067

URL: https://github.com/llvm/llvm-project/commit/b740899c500ba6a707711b74bfdacf104e8a8067
DIFF: https://github.com/llvm/llvm-project/commit/b740899c500ba6a707711b74bfdacf104e8a8067.diff

LOG: [Indvars][NFCI] Simplify assertion.

This should be semantically identical. Also avoids unused variable
warnings in Release builds.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/IndVarSimplify.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index 1355e9bc8d9c2..ed2004f39a066 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -1114,8 +1114,8 @@ bool WidenIV::widenWithVariantUse(NarrowIVDefUse DU) {
 
   // The operand that is not defined by NarrowDef of DU. Let's call it the
   // other operand.
-  unsigned ExtendOperIdx = DU.NarrowUse->getOperand(0) == NarrowDef ? 1 : 0;
-  assert(DU.NarrowUse->getOperand(1 - ExtendOperIdx) == DU.NarrowDef &&
+  assert((NarrowUse->getOperand(0) == NarrowDef ||
+          NarrowUse->getOperand(1) == NarrowDef) &&
          "bad DU");
 
   const OverflowingBinaryOperator *OBO =


        


More information about the llvm-commits mailing list