@@ -4634,16 +4634,15 @@ Instruction *InstCombinerImpl::foldICmpBinOp(ICmpInst &I,
4634
4634
// Analyze the case when either Op0 or Op1 is an add instruction.
4635
4635
// Op0 = A + B (or A and B are null); Op1 = C + D (or C and D are null).
4636
4636
Value *A = nullptr , *B = nullptr , *C = nullptr , *D = nullptr ;
4637
- auto hasNoWrapProblem = [&](const BinaryOperator &BO, const Value *X,
4638
- const Value *Y, bool &HasNSW,
4639
- bool &HasNUW) -> bool {
4637
+ auto hasNoWrapProblem = [](const BinaryOperator &BO, CmpInst::Predicate Pred,
4638
+ bool &HasNSW, bool &HasNUW) -> bool {
4640
4639
if (isa<OverflowingBinaryOperator>(BO)) {
4641
4640
HasNUW = BO.hasNoUnsignedWrap ();
4642
4641
HasNSW = BO.hasNoSignedWrap ();
4643
4642
return ICmpInst::isEquality (Pred) ||
4644
4643
(CmpInst::isUnsigned (Pred) && HasNUW) ||
4645
4644
(CmpInst::isSigned (Pred) && HasNSW);
4646
- } else if (BO0-> getOpcode () == Instruction::Or) {
4645
+ } else if (BO. getOpcode () == Instruction::Or) {
4647
4646
HasNUW = true ;
4648
4647
HasNSW = true ;
4649
4648
return true ;
@@ -4654,11 +4653,11 @@ Instruction *InstCombinerImpl::foldICmpBinOp(ICmpInst &I,
4654
4653
4655
4654
if (BO0) {
4656
4655
match (BO0, m_AddLike (m_Value (A), m_Value (B)));
4657
- NoOp0WrapProblem = hasNoWrapProblem (*BO0, A, B , Op0HasNSW, Op0HasNUW);
4656
+ NoOp0WrapProblem = hasNoWrapProblem (*BO0, Pred , Op0HasNSW, Op0HasNUW);
4658
4657
}
4659
4658
if (BO1) {
4660
4659
match (BO1, m_AddLike (m_Value (C), m_Value (D)));
4661
- NoOp1WrapProblem = hasNoWrapProblem (*BO1, C, D , Op1HasNSW, Op1HasNUW);
4660
+ NoOp1WrapProblem = hasNoWrapProblem (*BO1, Pred , Op1HasNSW, Op1HasNUW);
4662
4661
}
4663
4662
4664
4663
if ((A == Op1 || B == Op1) && NoOp0WrapProblem)
0 commit comments