[CostModel] move early exit for free intrinsics

This should be NFC unless some target was expecting that
some form of cttz/ctlz/memcpy is free in terms of size/latency
but not free in throughput cost.
This commit is contained in:
Sanjay Patel 2020-09-28 12:28:23 -04:00
parent 1121a583b8
commit 745abbbb85
1 changed files with 4 additions and 4 deletions

View File

@ -1121,9 +1121,12 @@ public:
/// Get intrinsic cost based on arguments.
unsigned getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
TTI::TargetCostKind CostKind) {
Intrinsic::ID IID = ICA.getID();
// Check for generically free intrinsics.
if (BaseT::getIntrinsicInstrCost(ICA, CostKind) == 0)
return 0;
// Special case some scalar intrinsics.
Intrinsic::ID IID = ICA.getID();
if (CostKind != TTI::TCK_RecipThroughput) {
switch (IID) {
default:
@ -1143,9 +1146,6 @@ public:
return BaseT::getIntrinsicInstrCost(ICA, CostKind);
}
if (BaseT::getIntrinsicInstrCost(ICA, CostKind) == 0)
return 0;
// TODO: Combine these two logic paths.
if (ICA.isTypeBasedOnly())
return getTypeBasedIntrinsicInstrCost(ICA, CostKind);