OSDN Git Service

[ValueTracking] Remove duplicate call to computeKnownBits for the operands of Select.
authorCraig Topper <craig.topper@gmail.com>
Thu, 13 Apr 2017 20:39:37 +0000 (20:39 +0000)
committerCraig Topper <craig.topper@gmail.com>
Thu, 13 Apr 2017 20:39:37 +0000 (20:39 +0000)
We call it unconditionally on the operands of the select. Then decide if its a min/max and call it on the min/max operands or on the select operands again. Either of those second calls will overwrite the results of the initial call so we can just delete the first call.

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

lib/Analysis/ValueTracking.cpp

index c72a3f6..3f8f645 100644 (file)
@@ -976,11 +976,7 @@ static void computeKnownBitsFromOperator(const Operator *I, APInt &KnownZero,
     break;
   }
   case Instruction::Select: {
-    computeKnownBits(I->getOperand(2), KnownZero, KnownOne, Depth + 1, Q);
-    computeKnownBits(I->getOperand(1), KnownZero2, KnownOne2, Depth + 1, Q);
-
-    const Value *LHS;
-    const Value *RHS;
+    const Value *LHS, *RHS;
     SelectPatternFlavor SPF = matchSelectPattern(I, LHS, RHS).Flavor;
     if (SelectPatternResult::isMinOrMax(SPF)) {
       computeKnownBits(RHS, KnownZero, KnownOne, Depth + 1, Q);