[InstCombine] Remove some repeated calls to getOperand. NFCI
authorCraig Topper <craig.topper@gmail.com>
Wed, 10 Jun 2020 23:54:09 +0000 (16:54 -0700)
committerCraig Topper <craig.topper@gmail.com>
Wed, 10 Jun 2020 23:54:50 +0000 (16:54 -0700)
We had alread loaded operand 1 and 2 of the select as TV and FV
using the more the readable getTrueValue/getFalseValue.

llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

index 375abac..e7a82b9 100644 (file)
@@ -922,8 +922,7 @@ Instruction *InstCombiner::FoldOpIntoSelect(Instruction &Op, SelectInst *SI) {
   if (auto *CI = dyn_cast<CmpInst>(SI->getCondition())) {
     if (CI->hasOneUse()) {
       Value *Op0 = CI->getOperand(0), *Op1 = CI->getOperand(1);
-      if ((SI->getOperand(1) == Op0 && SI->getOperand(2) == Op1) ||
-          (SI->getOperand(2) == Op0 && SI->getOperand(1) == Op1))
+      if ((TV == Op0 && FV == Op1) || (FV == Op0 && TV == Op1))
         return nullptr;
     }
   }