Skip to content

Commit fdff967

Browse files
committed
Remove the first condition parameter
1 parent 1b1e5e2 commit fdff967

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

llvm/include/llvm/IR/PatternMatch.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,10 +1787,11 @@ m_SelectCst(const Cond &C) {
17871787
}
17881788

17891789
/// Match Select(C, LHS, RHS) or Select(C, RHS, LHS)
1790-
template <typename Cond, typename LHS, typename RHS>
1791-
inline ThreeOps_match<Cond, LHS, RHS, Instruction::Select, true>
1792-
m_c_Select(const Cond &C, const LHS &L, const RHS &R) {
1793-
return ThreeOps_match<Cond, LHS, RHS, Instruction::Select, true>(C, L, R);
1790+
template <typename LHS, typename RHS>
1791+
inline ThreeOps_match<decltype(m_Value()), LHS, RHS, Instruction::Select, true>
1792+
m_c_Select(const LHS &L, const RHS &R) {
1793+
return ThreeOps_match<decltype(m_Value()), LHS, RHS, Instruction::Select,
1794+
true>(m_Value(), L, R);
17941795
}
17951796

17961797
/// Matches FreezeInst.

llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2245,8 +2245,7 @@ Instruction *InstCombinerImpl::visitSub(BinaryOperator &I) {
22452245
const Instruction *UI = dyn_cast<Instruction>(U);
22462246
if (!UI)
22472247
return false;
2248-
return match(UI,
2249-
m_c_Select(m_Value(), m_Specific(Op1), m_Specific(&I)));
2248+
return match(UI, m_c_Select(m_Specific(Op1), m_Specific(&I)));
22502249
})) {
22512250
if (Value *NegOp1 = Negator::Negate(IsNegation, /* IsNSW */ IsNegation &&
22522251
I.hasNoSignedWrap(),

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,8 +1736,7 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
17361736
Value *X;
17371737
if (match(IIOperand, m_Neg(m_Value(X))))
17381738
return replaceOperand(*II, 0, X);
1739-
if (match(IIOperand,
1740-
m_c_Select(m_Value(), m_Neg(m_Value(X)), m_Deferred(X))))
1739+
if (match(IIOperand, m_c_Select(m_Neg(m_Value(X)), m_Deferred(X))))
17411740
return replaceOperand(*II, 0, X);
17421741

17431742
Value *Y;

llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8437,7 +8437,7 @@ Instruction *InstCombinerImpl::visitFCmpInst(FCmpInst &I) {
84378437
case Instruction::Select:
84388438
// fcmp eq (cond ? x : -x), 0 --> fcmp eq x, 0
84398439
if (FCmpInst::isEquality(Pred) && match(RHSC, m_AnyZeroFP()) &&
8440-
match(LHSI, m_c_Select(m_Value(), m_FNeg(m_Value(X)), m_Deferred(X))))
8440+
match(LHSI, m_c_Select(m_FNeg(m_Value(X)), m_Deferred(X))))
84418441
return replaceOperand(I, 0, X);
84428442
if (Instruction *NV = FoldOpIntoSelect(I, cast<SelectInst>(LHSI)))
84438443
return NV;

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3814,8 +3814,7 @@ static bool foldTwoEntryPHINode(PHINode *PN, const TargetTransformInfo &TTI,
38143814
// These can often be turned into switches and other things.
38153815
auto IsBinOpOrAnd = [](Value *V) {
38163816
return match(
3817-
V, m_CombineOr(m_BinOp(),
3818-
m_c_Select(m_Value(), m_ImmConstant(), m_Value())));
3817+
V, m_CombineOr(m_BinOp(), m_c_Select(m_ImmConstant(), m_Value())));
38193818
};
38203819
if (PN->getType()->isIntegerTy(1) &&
38213820
(IsBinOpOrAnd(PN->getIncomingValue(0)) ||

0 commit comments

Comments
 (0)