Skip to content

Commit 980d666

Browse files
fhahnakuhlens
authored andcommitted
[VPlan] Only skip induction phis in planContainsAdditionalSimps (NFC).
Skip induction phis when checking for simplifications, as they may not be lowered directly be lowered to a corresponding PHI recipe. Reductions and first-order recurrences will get lowered to phi recipes, unless they are removed. Considering them for simplifications allows removing them if there are no remaining users. NFC as currently reduction and recurrence phis are not simplified/removed if dead.
1 parent 6d14414 commit 980d666

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7061,7 +7061,10 @@ static bool planContainsAdditionalSimplifications(VPlan &Plan,
70617061
return any_of(TheLoop->blocks(), [&SeenInstrs, &CostCtx,
70627062
TheLoop](BasicBlock *BB) {
70637063
return any_of(*BB, [&SeenInstrs, &CostCtx, TheLoop, BB](Instruction &I) {
7064-
if (isa<PHINode>(&I) && BB == TheLoop->getHeader())
7064+
// Skip induction phis when checking for simplifications, as they may not
7065+
// be lowered directly be lowered to a corresponding PHI recipe.
7066+
if (isa<PHINode>(&I) && BB == TheLoop->getHeader() &&
7067+
CostCtx.CM.Legal->isInductionPhi(cast<PHINode>(&I)))
70657068
return false;
70667069
return !SeenInstrs.contains(&I) && !CostCtx.skipCostComputation(&I, true);
70677070
});

0 commit comments

Comments
 (0)