Skip to content

Commit 7e59362

Browse files
RKSimonmemfrob
authored andcommitted
[CostModel][TTI] Replace BAD_ICMP_PREDICATE with ICMP_ULT/UGT for generic uadd/usubo cost expansion
Match the predicates used in TargetLowering::expandUADDSUBO
1 parent 30358cf commit 7e59362

File tree

3 files changed

+244
-241
lines changed

3 files changed

+244
-241
lines changed

llvm/include/llvm/CodeGen/BasicTTIImpl.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1809,12 +1809,15 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
18091809
unsigned Opcode = IID == Intrinsic::uadd_with_overflow
18101810
? BinaryOperator::Add
18111811
: BinaryOperator::Sub;
1812+
CmpInst::Predicate Pred = IID == Intrinsic::uadd_with_overflow
1813+
? CmpInst::ICMP_ULT
1814+
: CmpInst::ICMP_UGT;
18121815

18131816
InstructionCost Cost = 0;
18141817
Cost += thisT()->getArithmeticInstrCost(Opcode, SumTy, CostKind);
18151818
Cost +=
18161819
thisT()->getCmpSelInstrCost(BinaryOperator::ICmp, SumTy, OverflowTy,
1817-
CmpInst::BAD_ICMP_PREDICATE, CostKind);
1820+
Pred, CostKind);
18181821
return Cost;
18191822
}
18201823
case Intrinsic::smul_with_overflow:

0 commit comments

Comments
 (0)