[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
Sun Jun 4 12:31:37 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGe19297471a09: [LV] Check if value was already not uniform for previous VF. (authored by fhahn).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151658/new/

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
@@ -4672,9 +4672,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, VF))
       return false;
     if (isa<LoadInst>(I))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151658.528249.patch
Type: text/x-patch
Size: 944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230604/191aa2fd/attachment.bin>


More information about the llvm-commits mailing list