[llvm] c6b340e - [LV] Emit remarks for vectorization decision before execute (NFCI).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 31 06:44:44 PDT 2025


Author: Florian Hahn
Date: 2025-08-31T14:41:40+01:00
New Revision: c6b340e5603dc1dee12f91b930836f78f97e7c31

URL: https://github.com/llvm/llvm-project/commit/c6b340e5603dc1dee12f91b930836f78f97e7c31
DIFF: https://github.com/llvm/llvm-project/commit/c6b340e5603dc1dee12f91b930836f78f97e7c31.diff

LOG: [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
https://github.com/llvm/llvm-project/pull/154510.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index fc0f3d5b6c2a0..56403dba92df2 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -10206,6 +10206,24 @@ bool LoopVectorizePass::processLoop(Loop *L) {
 
   bool DisableRuntimeUnroll = false;
   MDNode *OrigLoopID = L->getLoopID();
+
+  // Report the vectorization decision.
+  if (VF.Width.isScalar()) {
+    using namespace ore;
+    assert(IC > 1);
+    ORE->emit([&]() {
+      return OptimizationRemark(LV_NAME, "Interleaved", L->getStartLoc(),
+                                L->getHeader())
+             << "interleaved loop (interleaved count: "
+             << NV("InterleaveCount", IC) << ")";
+    });
+  } else {
+    // Report the vectorization decision.
+    reportVectorization(ORE, L, VF, IC);
+  }
+  if (ORE->allowExtraAnalysis(LV_NAME))
+    checkMixedPrecision(L, ORE);
+
   // If we decided that it is *legal* to interleave or vectorize the loop, then
   // do it.
 
@@ -10276,22 +10294,6 @@ bool LoopVectorizePass::processLoop(Loop *L) {
     if (!Checks.hasChecks() && !VF.Width.isScalar())
       DisableRuntimeUnroll = true;
   }
-  if (VF.Width.isScalar()) {
-    using namespace ore;
-    assert(IC > 1);
-    ORE->emit([&]() {
-      return OptimizationRemark(LV_NAME, "Interleaved", L->getStartLoc(),
-                                L->getHeader())
-             << "interleaved loop (interleaved count: "
-             << NV("InterleaveCount", IC) << ")";
-    });
-  } else {
-    // Report the vectorization decision.
-    reportVectorization(ORE, L, VF, IC);
-  }
-
-  if (ORE->allowExtraAnalysis(LV_NAME))
-    checkMixedPrecision(L, ORE);
 
   assert(DT->verify(DominatorTree::VerificationLevel::Fast) &&
          "DT not preserved correctly");


        


More information about the llvm-commits mailing list