[clang] [flang] [mlir] [flang] Add support for -mprefer-vector-width=<value> (PR #141380)

via cfe-commits cfe-commits at lists.llvm.org
Mon May 26 00:52:56 PDT 2025


================
@@ -2636,6 +2636,10 @@ void ModuleImport::processFunctionAttributes(llvm::Function *func,
     funcOp.setTargetFeaturesAttr(
         LLVM::TargetFeaturesAttr::get(context, attr.getValueAsString()));
 
+  if (llvm::Attribute attr = func->getFnAttribute("prefer-vector-width");
+      attr.isStringAttribute())
+    funcOp.setPreferVectorWidth(attr.getValueAsString());
----------------
jeanPerier wrote:

Can you add an import test in mlir/test/Target/LLVMIR/Import and an export one in ‎mlir/test/Target/LLVMIR (just like the ones for tune-cpu)?

Even though the export is tested indirectly in flang, it is best to add an explicit test here.

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


More information about the cfe-commits mailing list