Skip to content

Commit e3fbf19

Browse files
committed
[SLP] getSpillCost - fully populate IntrinsicCostAttributes to improve cost analysis. (#124129) (REAPPLIED)
We were only constructing the IntrinsicCostAttributes with the arg type info, and not the args themselves, preventing more detailed cost analysis (constant / uniform args etc.) Just pass the whole IntrinsicInst to the constructor and let it resolve everything it can. Noticed while having yet another attempt at #63980 Reapplied cleanup now that #125223 and #124984 have landed.
1 parent 3ab1880 commit e3fbf19

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12238,18 +12238,12 @@ InstructionCost BoUpSLP::getSpillCost() {
1223812238
return false;
1223912239
if (II->isAssumeLikeIntrinsic())
1224012240
return true;
12241-
FastMathFlags FMF;
12242-
SmallVector<Type *, 4> Tys;
12243-
for (auto &ArgOp : II->args())
12244-
Tys.push_back(ArgOp->getType());
12245-
if (auto *FPMO = dyn_cast<FPMathOperator>(II))
12246-
FMF = FPMO->getFastMathFlags();
12247-
IntrinsicCostAttributes ICA(II->getIntrinsicID(), II->getType(), Tys,
12248-
FMF);
12241+
IntrinsicCostAttributes ICA(II->getIntrinsicID(), *II);
1224912242
InstructionCost IntrCost =
1225012243
TTI->getIntrinsicInstrCost(ICA, TTI::TCK_RecipThroughput);
12251-
InstructionCost CallCost = TTI->getCallInstrCost(
12252-
nullptr, II->getType(), Tys, TTI::TCK_RecipThroughput);
12244+
InstructionCost CallCost =
12245+
TTI->getCallInstrCost(nullptr, II->getType(), ICA.getArgTypes(),
12246+
TTI::TCK_RecipThroughput);
1225312247
return IntrCost < CallCost;
1225412248
};
1225512249

0 commit comments

Comments
 (0)