[llvm] [LoopIdiomVectorize] Bail when vectorization is disabled (PR #181142)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 18 09:11:44 PST 2026


================
@@ -1004,6 +1019,17 @@ bool LoopIdiomVectorize::recognizeFindFirstByte() {
     return false;
 
   auto *InnerLoop = CurLoop->getSubLoops().front();
+  Function &F = *InnerLoop->getHeader()->getParent();
+
+  // Bail if vectorization is disabled on inner loop.
+  LoopVectorizeHints Hints(InnerLoop, /*InterleaveOnlyWhenForced=*/true, ORE);
+  if (!Hints.allowVectorization(&F, InnerLoop,
+                                /*VectorizeOnlyWhenForced=*/false)) {
+    LLVM_DEBUG(dbgs() << DEBUG_TYPE << " is disabled on " << F.getName()
----------------
mshockwave wrote:

ditto using loop's name. Also, could we additionally say "...is disabled on _inner loop_..."

https://github.com/llvm/llvm-project/pull/181142


More information about the llvm-commits mailing list