[flang-commits] [mlir] [flang] [Flang][MLIR][OpenMP] Add support for target-cpu and target-features (PR #75344)
Sergio Afonso via flang-commits
flang-commits at lists.llvm.org
Thu Dec 14 02:27:26 PST 2023
================
@@ -379,6 +381,19 @@ mlir::convertFuncOpToLLVMFuncOp(FunctionOpInterface funcOp,
newFuncOp.setMemoryAttr(memoryAttr);
}
+ // Create target_features attribute.
+ if (funcOp->hasAttr(targetFeaturesAttrName)) {
+ auto attr = funcOp->getAttrOfType<StringAttr>(targetFeaturesAttrName);
+ if (!attr) {
+ funcOp->emitError() << "Contains " << targetFeaturesAttrName
+ << " attribute not of type StringAttr";
+ return rewriter.notifyMatchFailure(
+ funcOp, "Contains target features attribute not of type StringAttr");
+ }
+ newFuncOp.setTargetFeaturesAttr(
+ LLVM::TargetFeaturesAttr::get(rewriter.getContext(), attr.strref()));
+ }
----------------
skatrak wrote:
Thanks for the feedback! I considered that option and initially decided against it just to avoid introducing references to LLVM dialect types into the Fortran bridge, which is admittedly a pretty weak reason to over complicate things here. I'll make that change and also rename the attribute to "target_features", so that it can be directly forwarded to the corresponding `llvm.func` attribute without any special handling in the Func to LLVM conversion stage.
https://github.com/llvm/llvm-project/pull/75344
More information about the flang-commits
mailing list