Skip to content

Commit 719e474

Browse files
committed
Address review comments
1 parent 0fae60f commit 719e474

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3590,23 +3590,14 @@ Instruction *InstCombinerImpl::foldSelectToCmp(SelectInst &SI) {
35903590
ICmpInst::isSigned(Pred) ? Intrinsic::scmp : Intrinsic::ucmp;
35913591

35923592
CallInst *Intrinsic = nullptr;
3593-
ICmpInst::Predicate NEPred;
35943593
// (x < y) ? -1 : zext(x != y)
35953594
if (ICmpInst::isLT(Pred) && match(TV, m_AllOnes()) &&
3596-
match(FV, m_ZExt(m_c_ICmp(NEPred, m_Specific(LHS), m_Specific(RHS)))) &&
3597-
NEPred == ICmpInst::ICMP_NE)
3595+
match(FV, m_ZExt(m_c_SpecificICmp(ICmpInst::ICMP_NE, m_Specific(LHS), m_Specific(RHS)))))
35983596
Intrinsic = Builder.CreateIntrinsic(SI.getType(), IID, {LHS, RHS});
35993597

36003598
// (x > y) ? 1 : sext(x != y)
36013599
if (ICmpInst::isGT(Pred) && match(TV, m_One()) &&
3602-
match(FV, m_SExt(m_c_ICmp(NEPred, m_Specific(LHS), m_Specific(RHS)))) &&
3603-
NEPred == ICmpInst::ICMP_NE)
3604-
Intrinsic = Builder.CreateIntrinsic(SI.getType(), IID, {LHS, RHS});
3605-
3606-
// (x >= y) ? zext(x != y) : -1
3607-
if (ICmpInst::isGE(Pred) &&
3608-
match(TV, m_ZExt(m_c_ICmp(NEPred, m_Specific(LHS), m_Specific(RHS)))) &&
3609-
NEPred == ICmpInst::ICMP_NE && match(FV, m_AllOnes()))
3600+
match(FV, m_SExt(m_c_SpecificICmp(ICmpInst::ICMP_NE, m_Specific(LHS), m_Specific(RHS)))))
36103601
Intrinsic = Builder.CreateIntrinsic(SI.getType(), IID, {LHS, RHS});
36113602

36123603
if (Intrinsic)

0 commit comments

Comments
 (0)