@@ -81,48 +81,6 @@ static Value *simplifyInstructionWithOperands(Instruction *I,
8181 const SimplifyQuery &SQ,
8282 unsigned MaxRecurse);
8383
84- static Value *foldSelectWithBinaryOp (Value *Cond, Value *TrueVal,
85- Value *FalseVal) {
86- BinaryOperator::BinaryOps BinOpCode;
87- if (auto *BO = dyn_cast<BinaryOperator>(Cond))
88- BinOpCode = BO->getOpcode ();
89- else
90- return nullptr ;
91-
92- CmpInst::Predicate ExpectedPred;
93- if (BinOpCode == BinaryOperator::Or) {
94- ExpectedPred = ICmpInst::ICMP_NE;
95- } else if (BinOpCode == BinaryOperator::And) {
96- ExpectedPred = ICmpInst::ICMP_EQ;
97- } else
98- return nullptr ;
99-
100- // %A = icmp eq %TV, %FV
101- // %B = icmp eq %X, %Y (and one of these is a select operand)
102- // %C = and %A, %B
103- // %D = select %C, %TV, %FV
104- // -->
105- // %FV
106-
107- // %A = icmp ne %TV, %FV
108- // %B = icmp ne %X, %Y (and one of these is a select operand)
109- // %C = or %A, %B
110- // %D = select %C, %TV, %FV
111- // -->
112- // %TV
113- Value *X, *Y;
114- if (!match (Cond,
115- m_c_BinOp (m_c_SpecificICmp (ExpectedPred, m_Specific (TrueVal),
116- m_Specific (FalseVal)),
117- m_SpecificICmp (ExpectedPred, m_Value (X), m_Value (Y)))))
118- return nullptr ;
119-
120- if (X == TrueVal || X == FalseVal || Y == TrueVal || Y == FalseVal)
121- return BinOpCode == BinaryOperator::Or ? TrueVal : FalseVal;
122-
123- return nullptr ;
124- }
125-
12684// / For a boolean type or a vector of boolean type, return false or a vector
12785// / with every element false.
12886static Constant *getFalse (Type *Ty) { return ConstantInt::getFalse (Ty); }
@@ -4994,9 +4952,6 @@ static Value *simplifySelectInst(Value *Cond, Value *TrueVal, Value *FalseVal,
49944952 if (Value *V = simplifySelectWithFCmp (Cond, TrueVal, FalseVal, Q, MaxRecurse))
49954953 return V;
49964954
4997- if (Value *V = foldSelectWithBinaryOp (Cond, TrueVal, FalseVal))
4998- return V;
4999-
50004955 std::optional<bool > Imp = isImpliedByDomCondition (Cond, Q.CxtI , Q.DL );
50014956 if (Imp)
50024957 return *Imp ? TrueVal : FalseVal;
0 commit comments