Skip to content

Commit 9d03b7d

Browse files
committed
[InstCombine] Use swapValues(); NFC
Less code, and makes it more obvious that these operands do not need to be added back to the worklist.
1 parent 23db972 commit 9d03b7d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,8 +2401,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
24012401
// Swap true/false values and condition.
24022402
CmpInst *Cond = cast<CmpInst>(CondVal);
24032403
Cond->setPredicate(CmpInst::getInversePredicate(Pred));
2404-
SI.setOperand(1, FalseVal);
2405-
SI.setOperand(2, TrueVal);
2404+
SI.swapValues();
24062405
SI.swapProfMetadata();
24072406
Worklist.push(Cond);
24082407
return &SI;
@@ -2783,8 +2782,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
27832782
Value *NotCond;
27842783
if (match(CondVal, m_Not(m_Value(NotCond)))) {
27852784
SI.setOperand(0, NotCond);
2786-
SI.setOperand(1, FalseVal);
2787-
SI.setOperand(2, TrueVal);
2785+
SI.swapValues();
27882786
SI.swapProfMetadata();
27892787
return &SI;
27902788
}

0 commit comments

Comments
 (0)