]> granicus.if.org Git - llvm/commitdiff
[InstCombine] Remove insertRangeTest code that handles the equality case.
authorCraig Topper <craig.topper@intel.com>
Sun, 21 Jul 2019 06:43:38 +0000 (06:43 +0000)
committerCraig Topper <craig.topper@intel.com>
Sun, 21 Jul 2019 06:43:38 +0000 (06:43 +0000)
For equality, the function called getTrue/getFalse with the VT
of the comparison input. But getTrue/getFalse need the boolean VT.
So if this code ever executed, it would assert.

I believe these cases are removed by InstSimplify so we don't get here.

So this patch just fixes up an assert to exclude the equality
possibility and removes the broken code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366649 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

index fd53c67b47fe04dd8e9b8a28fe445253bbf1f05e..1a7a25b21c31d115a2c1033c14564d7fcfe6b8e5 100644 (file)
@@ -164,12 +164,10 @@ Instruction *InstCombiner::OptAndOp(BinaryOperator *Op,
 /// whether to treat V, Lo, and Hi as signed or not.
 Value *InstCombiner::insertRangeTest(Value *V, const APInt &Lo, const APInt &Hi,
                                      bool isSigned, bool Inside) {
-  assert((isSigned ? Lo.sle(Hi) : Lo.ule(Hi)) &&
-         "Lo is not <= Hi in range emission code!");
+  assert((isSigned ? Lo.slt(Hi) : Lo.ult(Hi)) &&
+         "Lo is not < Hi in range emission code!");
 
   Type *Ty = V->getType();
-  if (Lo == Hi)
-    return Inside ? ConstantInt::getFalse(Ty) : ConstantInt::getTrue(Ty);
 
   // V >= Min && V <  Hi --> V <  Hi
   // V <  Min || V >= Hi --> V >= Hi