@@ -5054,14 +5054,10 @@ InstCombinerImpl::foldICmpWithMinMaxImpl(Instruction &I,
5054
5054
case ICmpInst::ICMP_UGT:
5055
5055
case ICmpInst::ICMP_SGE:
5056
5056
case ICmpInst::ICMP_UGE: {
5057
- auto FoldIntoConstant = [&](bool Value) {
5058
- return replaceInstUsesWith (
5059
- I, Constant::getIntegerValue (
5060
- I.getType (), APInt (1U , static_cast <uint64_t >(Value))));
5061
- };
5062
5057
auto FoldIntoCmpYZ = [&]() -> Instruction * {
5063
5058
if (CmpYZ.has_value ())
5064
- return FoldIntoConstant (*CmpYZ);
5059
+ return replaceInstUsesWith (I,
5060
+ ConstantInt::getBool (I.getType (), *CmpYZ));
5065
5061
return ICmpInst::Create (Instruction::ICmp, Pred, Y, Z);
5066
5062
};
5067
5063
@@ -5073,7 +5069,7 @@ InstCombinerImpl::foldICmpWithMinMaxImpl(Instruction &I,
5073
5069
// min(X, Y) <= Z X <= Z true
5074
5070
// max(X, Y) > Z X > Z true
5075
5071
// max(X, Y) >= Z X >= Z true
5076
- return FoldIntoConstant ( true );
5072
+ return replaceInstUsesWith (I, ConstantInt::getTrue (I. getType ()) );
5077
5073
} else {
5078
5074
// Expr Fact Result
5079
5075
// max(X, Y) < Z X < Z Y < Z
@@ -5096,7 +5092,7 @@ InstCombinerImpl::foldICmpWithMinMaxImpl(Instruction &I,
5096
5092
// max(X, Y) <= Z X > Z false
5097
5093
// min(X, Y) > Z X <= Z false
5098
5094
// min(X, Y) >= Z X < Z false
5099
- return FoldIntoConstant ( false );
5095
+ return replaceInstUsesWith (I, ConstantInt::getFalse (I. getType ()) );
5100
5096
}
5101
5097
}
5102
5098
break ;
0 commit comments