Skip to content

Commit c6b340e

Browse files
committed
[LV] Emit remarks for vectorization decision before execute (NFCI).
Move the emission of remarks for the vectorization decision before executing the plan, in preparation for #154510.
1 parent 1f2d461 commit c6b340e

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10206,6 +10206,24 @@ bool LoopVectorizePass::processLoop(Loop *L) {
1020610206

1020710207
bool DisableRuntimeUnroll = false;
1020810208
MDNode *OrigLoopID = L->getLoopID();
10209+
10210+
// Report the vectorization decision.
10211+
if (VF.Width.isScalar()) {
10212+
using namespace ore;
10213+
assert(IC > 1);
10214+
ORE->emit([&]() {
10215+
return OptimizationRemark(LV_NAME, "Interleaved", L->getStartLoc(),
10216+
L->getHeader())
10217+
<< "interleaved loop (interleaved count: "
10218+
<< NV("InterleaveCount", IC) << ")";
10219+
});
10220+
} else {
10221+
// Report the vectorization decision.
10222+
reportVectorization(ORE, L, VF, IC);
10223+
}
10224+
if (ORE->allowExtraAnalysis(LV_NAME))
10225+
checkMixedPrecision(L, ORE);
10226+
1020910227
// If we decided that it is *legal* to interleave or vectorize the loop, then
1021010228
// do it.
1021110229

@@ -10276,22 +10294,6 @@ bool LoopVectorizePass::processLoop(Loop *L) {
1027610294
if (!Checks.hasChecks() && !VF.Width.isScalar())
1027710295
DisableRuntimeUnroll = true;
1027810296
}
10279-
if (VF.Width.isScalar()) {
10280-
using namespace ore;
10281-
assert(IC > 1);
10282-
ORE->emit([&]() {
10283-
return OptimizationRemark(LV_NAME, "Interleaved", L->getStartLoc(),
10284-
L->getHeader())
10285-
<< "interleaved loop (interleaved count: "
10286-
<< NV("InterleaveCount", IC) << ")";
10287-
});
10288-
} else {
10289-
// Report the vectorization decision.
10290-
reportVectorization(ORE, L, VF, IC);
10291-
}
10292-
10293-
if (ORE->allowExtraAnalysis(LV_NAME))
10294-
checkMixedPrecision(L, ORE);
1029510297

1029610298
assert(DT->verify(DominatorTree::VerificationLevel::Fast) &&
1029710299
"DT not preserved correctly");

0 commit comments

Comments
 (0)