[flang-commits] [clang] [flang] [mlir] [flang] Add basic -mtune support (PR #95043)

Tobias Gysi via flang-commits flang-commits at lists.llvm.org
Wed Jun 12 10:37:56 PDT 2024


================
@@ -1796,6 +1797,10 @@ void ModuleImport::processFunctionAttributes(llvm::Function *func,
       attr.isStringAttribute())
     funcOp.setTargetCpuAttr(StringAttr::get(context, attr.getValueAsString()));
 
+  if (llvm::Attribute attr = func->getFnAttribute("tune-cpu");
+      attr.isStringAttribute())
+    funcOp.setTuneCpuAttr(StringAttr::get(context, attr.getValueAsString()));
----------------
gysit wrote:

Could you also add a small test that verifies the import / export works independent from Flang?

The target_cpu attributes are tested here:
```
llvm-project/mlir/test/Target/LLVMIR/target-cpu.mlir
llvm-project/mlir/test/Target/LLVMIR/Import/target-cpu.ll
```
It may make sense to add the tests in the same files and maybe rename them to target-and-tune-cpu.mlir/ll or have a separate set of files if the attributes are unrelated (which is not my impression).

Thanks!

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


More information about the flang-commits mailing list