Skip to content

Commit 3cef99f

Browse files
committed
[SLP] Use early return in NoCallIntrinsic
1 parent 41f7607 commit 3cef99f

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12231,25 +12231,24 @@ InstructionCost BoUpSLP::getSpillCost() const {
1223112231
}
1223212232

1223312233
auto NoCallIntrinsic = [this](Instruction *I) {
12234-
if (auto *II = dyn_cast<IntrinsicInst>(I)) {
12235-
if (II->isAssumeLikeIntrinsic())
12236-
return true;
12237-
FastMathFlags FMF;
12238-
SmallVector<Type *, 4> Tys;
12239-
for (auto &ArgOp : II->args())
12240-
Tys.push_back(ArgOp->getType());
12241-
if (auto *FPMO = dyn_cast<FPMathOperator>(II))
12242-
FMF = FPMO->getFastMathFlags();
12243-
IntrinsicCostAttributes ICA(II->getIntrinsicID(), II->getType(), Tys,
12244-
FMF);
12245-
InstructionCost IntrCost =
12246-
TTI->getIntrinsicInstrCost(ICA, TTI::TCK_RecipThroughput);
12247-
InstructionCost CallCost = TTI->getCallInstrCost(
12248-
nullptr, II->getType(), Tys, TTI::TCK_RecipThroughput);
12249-
if (IntrCost < CallCost)
12250-
return true;
12251-
}
12252-
return false;
12234+
auto *II = dyn_cast<IntrinsicInst>(I);
12235+
if (!II)
12236+
return false;
12237+
if (II->isAssumeLikeIntrinsic())
12238+
return true;
12239+
FastMathFlags FMF;
12240+
SmallVector<Type *, 4> Tys;
12241+
for (auto &ArgOp : II->args())
12242+
Tys.push_back(ArgOp->getType());
12243+
if (auto *FPMO = dyn_cast<FPMathOperator>(II))
12244+
FMF = FPMO->getFastMathFlags();
12245+
IntrinsicCostAttributes ICA(II->getIntrinsicID(), II->getType(), Tys,
12246+
FMF);
12247+
InstructionCost IntrCost =
12248+
TTI->getIntrinsicInstrCost(ICA, TTI::TCK_RecipThroughput);
12249+
InstructionCost CallCost = TTI->getCallInstrCost(
12250+
nullptr, II->getType(), Tys, TTI::TCK_RecipThroughput);
12251+
return IntrCost < CallCost;
1225312252
};
1225412253

1225512254
// Debug information does not impact spill cost.

0 commit comments

Comments
 (0)