[llvm] [LoopVectorize] Add metadata to distinguish vectorized loop body from scalar remainder (PR #190258)

Adel Ejjeh via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 7 07:15:32 PDT 2026


================
@@ -25,13 +25,28 @@ static void warnAboutLeftoverTransformations(Loop *L,
                                              OptimizationRemarkEmitter *ORE) {
   if (hasUnrollTransformation(L) == TM_ForcedByUser) {
     LLVM_DEBUG(dbgs() << "Leftover unroll transformation\n");
+
+    // Determine whether this loop originated from the vectorizer so we can
+    // produce more informative remarks.
+    bool IsVectorBody =
+        getBooleanLoopAttribute(L, "llvm.loop.vectorize.vector_body");
+    bool IsScalarRemainder =
+        getBooleanLoopAttribute(L, "llvm.loop.vectorize.scalar_remainder");
+    Twine LoopKind = "";
+    if (IsVectorBody)
+      LoopKind.concat("vectorized ");
+    if (IsScalarRemainder)
----------------
adelejjeh wrote:

I think you are correct. I will reword it!

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


More information about the llvm-commits mailing list