[llvm] 94b1404 - [InstCombine] Remove some repeated calls to getOperand. NFCI
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 10 16:57:01 PDT 2020
Author: Craig Topper
Date: 2020-06-10T16:54:50-07:00
New Revision: 94b14045870d48dc0acfb5ee3fd0b707e4cb2d45
URL: https://github.com/llvm/llvm-project/commit/94b14045870d48dc0acfb5ee3fd0b707e4cb2d45
DIFF: https://github.com/llvm/llvm-project/commit/94b14045870d48dc0acfb5ee3fd0b707e4cb2d45.diff
LOG: [InstCombine] Remove some repeated calls to getOperand. NFCI
We had alread loaded operand 1 and 2 of the select as TV and FV
using the more the readable getTrueValue/getFalseValue.
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 375abacb9990..e7a82b9099c2 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -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;
}
}
More information about the llvm-commits
mailing list