[PATCH] D129473: [LV] Make scalable-vectorization not work if there is a specified scalable pragma hint.

Yeting Kuo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 01:30:09 PDT 2022


fakepaper56 created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
fakepaper56 requested review of this revision.
Herald added subscribers: llvm-commits, alextsao1999.
Herald added a project: LLVM.

For issue github.com/llvm/llvm-project/issues/56462, the patch make
ForceScalableVectorization have lower priority than pragma, in other word,
ForceScalableVectorization will only work if there is no specified scalable
pragma hint.

After the patch, we could disable vectorization with -scalable-vectorization=on
by pragma vectorize_width(1, fixed).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129473

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp


Index: llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
@@ -128,13 +128,13 @@
       // property, then assume it concerns only a fixed-width UserVF.
       // If width is not set, the flag takes precedence.
       Scalable.Value = SK_FixedWidthOnly;
-  }
 
-  // If the flag is set to force any use of scalable vectors, override the loop
-  // hints.
-  if (ForceScalableVectorization.getValue() !=
-      LoopVectorizeHints::SK_Unspecified)
-    Scalable.Value = ForceScalableVectorization.getValue();
+    // If the flag is set to force any use of scalable vectors, override the
+    // loop hints.
+    if (ForceScalableVectorization.getValue() !=
+        LoopVectorizeHints::SK_Unspecified)
+      Scalable.Value = ForceScalableVectorization.getValue();
+  }
 
   // Scalable vectorization is disabled if no preference is specified.
   if ((LoopVectorizeHints::ScalableForceKind)Scalable.Value == SK_Unspecified)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129473.443579.patch
Type: text/x-patch
Size: 1125 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220711/acd99c93/attachment.bin>


More information about the llvm-commits mailing list