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

Hocky Yudhiono llvmlistbot at llvm.org
Tue Mar 24 05:45:56 PDT 2026


hockyy wrote:

> > [#182987 (comment)](https://github.com/llvm/llvm-project/pull/182987#discussion_r2852467344) @joker-eph Changing this will cause some errors on both of the former two call sites.
> 
> I don't quite get what you mean, do you mind expanding?

```
module {
  func.func private @drop_linkage_attr() -> (memref<f32> {test.returnOne}) attributes {llvm.emit_c_interface, llvm.linkage = #llvm.linkage<weak>}
}
```

running this
```
mlir-opt testcase.mlir --convert-func-to-llvm --debug
```

will go through this function
<img width="902" height="685" alt="image" src="https://github.com/user-attachments/assets/745c95d6-762a-401c-9ce2-823ff54bf62f" />

which will call the
```
  filterFuncAttributes(funcOp, attributes);
```
getAttributeNames contains the plain attribute names without any `llvm.*` prefix. So some of the `llvm.*`  discardable attributes are not discarded. Plus, `varargsAttrName` is not part of the set. So it won't be removed.


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


More information about the Mlir-commits mailing list