[clang] [clang][CodeGen] Fix metadata when vectorization is disabled by pragma (PR #135163)

Luke Lau via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 10 07:23:46 PDT 2025


================
@@ -194,7 +194,7 @@ void for_test_scalable(int *List, int Length) {
   }
 }
 
-// Verify for loop is performing scalable vectorization
+// Verify for loop is NOT performing vectorization because the width is 1
----------------
lukel97 wrote:

> If taking the intent of the original implementation, then it appears to not vectorize the loop.

Yeah I think that makes sense, i.e. we should disable vectorization if `(Attrs.VectorizeEnable == LoopAttributes::Disable || (Attrs.VectorizeWidth == 1 && Attrs.VectorizeScalable != LoopAttributes:: Enable))`.

We should probably also update this bit in the docs to be explicit about it:

> Specifying a **non-scalable** width/count of 1 disables the optimization, and is equivalent to vectorize(disable) or interleave(disable).

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


More information about the cfe-commits mailing list