================
@@ -132,8 +132,11 @@ LoopVectorizeHints::LoopVectorizeHints(const Loop *L,
 
   // If the flag is set to force any use of scalable vectors, override the loop
   // hints.
-  if (ForceScalableVectorization.getValue() !=
-      LoopVectorizeHints::SK_Unspecified)
+  // However: A preference must not turn a UserVF of 1, used by e.g.
+  // vectorize(disable) pragmas, into a vscale x 1 VF.
+  if (ForceScalableVectorization.getValue() != SK_Unspecified &&
+      (Width.Value != 1 ||
----------------
gbossu wrote:

Ultimately, my preference would be something like below, where 
`-scalable-vectorization` has lower precedence than pragmas for 
`SK_PreferScalable` values, but higher precedence for `SK_FixedWidthOnly` and 
`SK_AlwaysScalable`. I.e.
```
  // Scalable vectorization is decided based on the following criteria
  // (increasing level of priority):
  //  1. Target TTI default
  //  2. -scalable-vectorization preferred value (SK_PreferScalable)
  //  3. !loop.vectorize.scalable enable/disable metadata
  //  4. -force-vector-width 's scalable attribute
  //  5. -scalable-vectorization forced value (SK_FixedWidthOnly or 
SK_AlwaysScalable) unless Width=1
```

And I also think the width choice should be changed to:
```
  //  1. !llvm.loop.vectorize.width metadata
  //  2. -force-vector-width cl::opt
```

This way, `-force-xxxx` options consistently have higher precedence than 
pragmas.

However, I feel it's a case where it's difficult to make everyone happy, so I'm 
happy to hear as many opinions as possible.

https://github.com/llvm/llvm-project/pull/226948
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to