[PATCH] D93677: [LV] Use ScalarEvolution::getURemExpr to reduce duplication.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 22 06:52:35 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGef4dbb2b7a85: [LV] Use ScalarEvolution::getURemExpr to reduce duplication. (authored by fhahn).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93677/new/
https://reviews.llvm.org/D93677
Files:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Index: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -5506,20 +5506,15 @@
"MaxVF must be a power of 2");
unsigned MaxVFtimesIC =
UserIC ? MaxVF.getFixedValue() * UserIC : MaxVF.getFixedValue();
- if (TC > 0 && TC % MaxVFtimesIC == 0) {
- // Accept MaxVF if we do not have a tail.
- LLVM_DEBUG(dbgs() << "LV: No tail will remain for any chosen VF.\n");
- return MaxVF;
- }
-
// Avoid tail folding if the trip count is known to be a multiple of any VF we
// chose.
ScalarEvolution *SE = PSE.getSE();
const SCEV *BackedgeTakenCount = PSE.getBackedgeTakenCount();
const SCEV *ExitCount = SE->getAddExpr(
BackedgeTakenCount, SE->getOne(BackedgeTakenCount->getType()));
- unsigned TCisMultipleOf = 1 << SE->GetMinTrailingZeros(ExitCount);
- if (TCisMultipleOf % MaxVFtimesIC == 0) {
+ const SCEV *Rem = SE->getURemExpr(
+ ExitCount, SE->getConstant(BackedgeTakenCount->getType(), MaxVFtimesIC));
+ if (Rem->isZero()) {
// Accept MaxVF if we do not have a tail.
LLVM_DEBUG(dbgs() << "LV: No tail will remain for any chosen VF.\n");
return MaxVF;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93677.313330.patch
Type: text/x-patch
Size: 1293 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201222/33cf9bc2/attachment.bin>
More information about the llvm-commits
mailing list