[llvm] [LV] Remove some unneeded logs (PR #194946)

Hassnaa Hamdi via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 16:03:03 PDT 2026


https://github.com/hassnaaHamdi updated https://github.com/llvm/llvm-project/pull/194946

>From 164d7173c0e47e8f47deee207029c30926e74f77 Mon Sep 17 00:00:00 2001
From: Hassnaa Hamdi <hassnaa.hamdi at arm.com>
Date: Wed, 29 Apr 2026 20:17:35 +0000
Subject: [PATCH 1/2] [LV][NFC] remove unneeded logs

---
 llvm/lib/Transforms/Vectorize/LoopVectorize.cpp               | 4 ++--
 .../Transforms/LoopVectorize/uncountable-single-exit-loops.ll | 2 --
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 8e9a12daa8281..a197df5c6cfdb 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -748,7 +748,7 @@ void reportVectorizationFailure(const StringRef DebugMsg,
                                 OptimizationRemarkEmitter *ORE, Loop *TheLoop,
                                 Instruction *I) {
   LLVM_DEBUG(debugVectorizationMessage("Not vectorizing: ", DebugMsg, I));
-  LoopVectorizeHints Hints(TheLoop, true /* doesn't matter */, *ORE);
+  LoopVectorizeHints Hints(TheLoop, false /* doesn't matter */, *ORE);
   ORE->emit(
       createLVAnalysis(Hints.vectorizeAnalysisPassName(), ORETag, TheLoop, I)
       << "loop not vectorized: " << OREMsg);
@@ -758,7 +758,7 @@ void reportVectorizationInfo(const StringRef Msg, const StringRef ORETag,
                              OptimizationRemarkEmitter *ORE,
                              const Loop *TheLoop, Instruction *I, DebugLoc DL) {
   LLVM_DEBUG(debugVectorizationMessage("", Msg, I));
-  LoopVectorizeHints Hints(TheLoop, true /* doesn't matter */, *ORE);
+  LoopVectorizeHints Hints(TheLoop, false /* doesn't matter */, *ORE);
   ORE->emit(createLVAnalysis(Hints.vectorizeAnalysisPassName(), ORETag, TheLoop,
                              I, DL)
             << Msg);
diff --git a/llvm/test/Transforms/LoopVectorize/uncountable-single-exit-loops.ll b/llvm/test/Transforms/LoopVectorize/uncountable-single-exit-loops.ll
index 23d9bee945ebe..e7ecf459ca6c9 100644
--- a/llvm/test/Transforms/LoopVectorize/uncountable-single-exit-loops.ll
+++ b/llvm/test/Transforms/LoopVectorize/uncountable-single-exit-loops.ll
@@ -5,14 +5,12 @@
 ; CHECK-LABEL: LV: Checking a loop in 'latch_exit_cannot_compute_btc_due_to_step'
 ; CHECK: 	   LV: Did not find one integer induction var.
 ; CHECK-NEXT:  LV: Not vectorizing: Cannot vectorize uncountable loop.
-; CHECK-NEXT:  LV: Interleaving disabled by the pass manager
 ; CHECK-NEXT:  LV: Not vectorizing: Cannot prove legality.
 
 ; CHECK-LABEL: LV: Checking a loop in 'header_exit_cannot_compute_btc_due_to_step'
 ; CHECK:       LV: Found an induction variable.
 ; CHECK-NEXT:  LV: Did not find one integer induction var.
 ; CHECK-NEXT:  LV: Not vectorizing: Cannot vectorize uncountable loop.
-; CHECK-NEXT:  LV: Interleaving disabled by the pass manager
 ; CHECK-NEXT:  LV: Not vectorizing: Cannot prove legality.
 
 ; CHECK-NOT: vector.body

>From 1c9c0be61b6b9d23bd40c2a17c3dced9a310f2cc Mon Sep 17 00:00:00 2001
From: Hassnaa Hamdi <hassnaa.hamdi at arm.com>
Date: Thu, 30 Apr 2026 22:44:51 +0000
Subject: [PATCH 2/2] add test file to test the option

---
 llvm/lib/Transforms/Vectorize/VPlan.cpp       |  6 +++--
 .../interleave-when-forced-opt.ll             | 26 +++++++++++++++++++
 2 files changed, 30 insertions(+), 2 deletions(-)
 create mode 100644 llvm/test/Transforms/LoopVectorize/interleave-when-forced-opt.ll

diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index 197ef22dc7fc6..f1d96443e1283 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -1788,7 +1788,8 @@ void LoopVectorizationPlanner::updateLoopMetadataAndProfileInfo(
       if (DisableRuntimeUnroll)
         addRuntimeUnrollDisableMetaData(OrigLoop);
 
-      LoopVectorizeHints Hints(OrigLoop, true, *ORE);
+      LoopVectorizeHints Hints(OrigLoop, /*InterleaveOnlyWhenForced*/ false,
+                               *ORE);
       Hints.setAlreadyVectorized();
     }
   }
@@ -1807,7 +1808,8 @@ void LoopVectorizationPlanner::updateLoopMetadataAndProfileInfo(
       VectorLoop->setLoopID(OrigLoopID);
 
     if (!VectorizingEpilogue) {
-      LoopVectorizeHints Hints(VectorLoop, true, *ORE);
+      LoopVectorizeHints Hints(VectorLoop, /*InterleaveOnlyWhenForced*/ false,
+                               *ORE);
       Hints.setAlreadyVectorized();
     }
   }
diff --git a/llvm/test/Transforms/LoopVectorize/interleave-when-forced-opt.ll b/llvm/test/Transforms/LoopVectorize/interleave-when-forced-opt.ll
new file mode 100644
index 0000000000000..661aaaae04704
--- /dev/null
+++ b/llvm/test/Transforms/LoopVectorize/interleave-when-forced-opt.ll
@@ -0,0 +1,26 @@
+; REQUIRES: asserts
+; RUN: opt -passes='loop-vectorize<interleave-forced-only>' -debug-only=loop-vectorize --disable-output -S %s 2>&1 | FileCheck --check-prefix=CHECK-INTERLEAVE-FORCED %s
+; RUN: opt -passes=loop-vectorize -debug-only=loop-vectorize --disable-output -S %s 2>&1 | FileCheck --check-prefix=CHECK-INTERLEAVE-NOT-FORCED %s
+
+
+; CHECK-INTERLEAVE-FORCED-LABEL: LV: Checking a loop in 'test_interleave_when_forced_opt'
+; CHECK-INTERLEAVE-FORCED:  LV: Interleaving disabled by the pass manager
+
+; CHECK-INTERLEAVE-NOT-FORCED-LABEL: LV: Checking a loop in 'test_interleave_when_forced_opt'
+; CHECK-INTERLEAVE-NOT-FORCED-NOT:  LV: Interleaving disabled by the pass manager
+
+define void @test_interleave_when_forced_opt(ptr %dst, i64 %n) {
+entry:
+  br label %loop
+
+loop:
+  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
+  %iv.next = add i64 %iv, 1
+  %gep = getelementptr i8, ptr %dst, i64 %iv
+  store i8 0, ptr %gep, align 1
+  %ec = icmp ult i64 %iv.next, %n
+  br i1 %ec, label %loop, label %exit
+
+exit:
+  ret void
+}



More information about the llvm-commits mailing list