[PATCH] D151658: [LV] Check if value was already not uniform for previous VF.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 29 12:38:32 PDT 2023
fhahn created this revision.
fhahn added reviewers: Ayal, gilr, rengolin.
Herald added subscribers: StephenFan, javed.absar, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added a subscriber: pcwang-thead.
Herald added a project: LLVM.
If the value was already known to not be uniform for the previous
(smaller VF), it cannot be uniform for the larger VF.
This slightly reduces compile-time, once uniformity checks are becoming
a bit more expensive due to using SCEV rewriting (D148841 <https://reviews.llvm.org/D148841>).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D151658
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
@@ -4671,9 +4671,17 @@
if (Cmp && TheLoop->contains(Cmp) && Cmp->hasOneUse())
addToWorklistIfAllowed(Cmp);
+ auto PrevVF = VF.divideCoefficientBy(2);
// Return true if all lanes perform the same memory operation, and we can
// thus chose to execute only one.
auto isUniformMemOpUse = [&](Instruction *I) {
+ // If the value was already known to not be uniform for the previous
+ // (smaller VF), it cannot be uniform for the larger VF.
+ if (PrevVF.isVector()) {
+ auto Iter = Uniforms.find(PrevVF);
+ if (Iter != Uniforms.end() && !Iter->second.contains(I))
+ return false;
+ }
if (!Legal->isUniformMemOp(*I))
return false;
if (isa<LoadInst>(I))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151658.526465.patch
Type: text/x-patch
Size: 940 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230529/8fabf407/attachment.bin>
More information about the llvm-commits
mailing list