[llvm] r300256 - [ValueTracking] Remove duplicate call to computeKnownBits for the operands of Select.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 13:39:37 PDT 2017


Author: ctopper
Date: Thu Apr 13 15:39:37 2017
New Revision: 300256

URL: http://llvm.org/viewvc/llvm-project?rev=300256&view=rev
Log:
[ValueTracking] Remove duplicate call to computeKnownBits for the operands of Select.

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.


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

Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=300256&r1=300255&r2=300256&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Thu Apr 13 15:39:37 2017
@@ -976,11 +976,7 @@ static void computeKnownBitsFromOperator
     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);




More information about the llvm-commits mailing list