Skip to content

Commit fb33033

Browse files
committed
[CodeGenPrepare] Remove target cost checks
1 parent 7357e3a commit fb33033

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

llvm/lib/CodeGen/CodeGenPrepare.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,20 +2124,13 @@ static bool adjustIsPower2Test(CmpInst *Cmp, const TargetLowering &TLI,
21242124
return false;
21252125
auto *II = cast<IntrinsicInst>(Cmp->getOperand(0));
21262126

2127-
// Check if it is profitable for the target
2128-
ICmpInst::Predicate NewPred =
2129-
Pred == ICmpInst::ICMP_EQ ? ICmpInst::ICMP_ULT : ICmpInst::ICMP_UGT;
2130-
if (TLI.isCtpopFast(TLI.getValueType(DL, II->getType())) &&
2131-
TTI.getCmpSelInstrCost(Instruction::ICmp, II->getType(), Cmp->getType(),
2132-
Pred) <
2133-
TTI.getCmpSelInstrCost(Instruction::ICmp, II->getType(),
2134-
Cmp->getType(), NewPred))
2135-
return false;
2136-
21372127
if (isKnownNonZero(II, DL)) {
2138-
if (Pred == ICmpInst::ICMP_EQ)
2128+
if (Pred == ICmpInst::ICMP_EQ) {
21392129
Cmp->setOperand(1, ConstantInt::get(II->getType(), 2));
2140-
Cmp->setPredicate(NewPred);
2130+
Cmp->setPredicate(ICmpInst::ICMP_ULT);
2131+
} else {
2132+
Cmp->setPredicate(ICmpInst::ICMP_UGT);
2133+
}
21412134
return true;
21422135
}
21432136
return false;

0 commit comments

Comments
 (0)