Skip to content

Commit 798a19a

Browse files
committed
[InstCombine] In visitXor, use m_Not on the instruction itself instead of looking for all ones in Op1. This is consistent with 3 other not checks before this one. NFCI
llvm-svn: 306617
1 parent 8456b16 commit 798a19a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2456,10 +2456,9 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) {
24562456
}
24572457
}
24582458

2459-
// xor (cmp A, B), true = not (cmp A, B) = !cmp A, B
2459+
// not (cmp A, B) = !cmp A, B
24602460
ICmpInst::Predicate Pred;
2461-
if (match(Op0, m_OneUse(m_Cmp(Pred, m_Value(), m_Value()))) &&
2462-
match(Op1, m_AllOnes())) {
2461+
if (match(&I, m_Not(m_OneUse(m_Cmp(Pred, m_Value(), m_Value()))))) {
24632462
cast<CmpInst>(Op0)->setPredicate(CmpInst::getInversePredicate(Pred));
24642463
return replaceInstUsesWith(I, Op0);
24652464
}

0 commit comments

Comments
 (0)