[PATCH] D122126: [LoopVectorize] Don't interleave when the number of runtime checks exceeds the threshold
Florian Hahn via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 12 08:46:11 PDT 2022
fhahn accepted this revision.
fhahn added a comment.
LGTM with additional suggestions inline, thanks!
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:10462
+ } else {
+ ORE->emit([&]() {
+ return OptimizationRemarkAnalysisAliasing(
----------------
I think we usually try to use early exits to reduce the indentation, so it might be worth doing something like
```
if (LVP.requiresTooManyRuntimeChecks()) {
ORE->emit([&]() {
return OptimizationRemarkAnalysisAliasing(
DEBUG_TYPE, "CantReorderMemOps", L->getStartLoc(),
L->getHeader())
<< "loop not vectorized: cannot prove it is safe to reorder "
"memory operations";
});
LLVM_DEBUG(dbgs() << "LV: Too many memory checks needed.\n");
Hints.emitRemarkWithHints();
return false;
}
// Select the interleave count.
IC = CM.selectInterleaveCount(VF.Width, *VF.Cost.getValue());
```
(this has the added benefit of not checking for `!LVP.requiresTooManyRuntimeChecks()` but the unnegated version, which is slightly more straight forward)
================
Comment at: llvm/test/Transforms/LoopVectorize/PowerPC/interleaved-pointer-runtime-check-unprofitable.ll:3
+
+; The case will do aggressive interleave on PowerPC, resulting in a lot of memory checks.
+; (On the A2, always unroll aggressively. In fact, if aggressive interleaving is enabled,
----------------
Might be good to precommit the test case and then just show the difference in this diff (without the fix `; CHECK: vector.memcheck`)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122126/new/
https://reviews.llvm.org/D122126
More information about the cfe-commits
mailing list