[Mlir-commits] [flang] [mlir] [mlir][func] Refactor FuncToLLVM discardable attributes algorithm (PR #188232)

Mehdi Amini llvmlistbot at llvm.org
Thu Mar 26 03:18:35 PDT 2026


================
@@ -25,6 +27,15 @@ namespace fir {
 
 namespace {
 
+/// Names of LLVM dialect function properties on `func.func` must use the
+/// `llvm.` prefix so convert-func-to-llvm can recognize them and lower them
+/// into `llvm.func` properties (bare ODS names are ignored as legacy spellings)
+static mlir::StringAttr getLlvmFuncPropertyAttrName(mlir::MLIRContext *ctx,
+                                                    mlir::StringAttr baseName) {
+  std::string storage = (llvm::Twine("llvm.") + baseName.getValue()).str();
+  return mlir::StringAttr::get(ctx, storage);
----------------
joker-eph wrote:

```suggestion
  return mlir::StringAttr::get(ctx, llvm::Twine("llvm.") + baseName.getValue());
```

The `get()` method takes a Twine directly, avoid spurious copy here.

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


More information about the Mlir-commits mailing list