[InstCombine] Use swapValues(); NFC

Less code, and makes it more obvious that these operands do not
need to be added back to the worklist.
This commit is contained in:
Nikita Popov 2020-02-08 16:57:28 +01:00
parent ffc3055731
commit ed54f1ad37

View File

@ -2401,8 +2401,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
// Swap true/false values and condition.
CmpInst *Cond = cast<CmpInst>(CondVal);
Cond->setPredicate(CmpInst::getInversePredicate(Pred));
SI.setOperand(1, FalseVal);
SI.setOperand(2, TrueVal);
SI.swapValues();
SI.swapProfMetadata();
Worklist.push(Cond);
return &SI;
@ -2783,8 +2782,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
Value *NotCond;
if (match(CondVal, m_Not(m_Value(NotCond)))) {
SI.setOperand(0, NotCond);
SI.setOperand(1, FalseVal);
SI.setOperand(2, TrueVal);
SI.swapValues();
SI.swapProfMetadata();
return &SI;
}