[Mlir-commits] [mlir] [MLIR][LLVM] Support dso_local_equivalent constants (PR #132131)

Tobias Gysi llvmlistbot at llvm.org
Thu Mar 20 00:01:49 PDT 2025


https://github.com/gysit commented:

Thanks! Code looks good to me.

There is a slight issue with constant folding this. Since it produces a FlatSymbolRefAttr like AddressOfOp it currently would be constant folded to an AddressOfOp if I understand correctly (see my comment on the PR). So maybe this is a hint that we should model this using AddressOfOp.

Is LLVM always generating a DSOLocalEquivalent if the symbol references a DSOLocalEquivalent? If this can be reliably computed from the IR we may just add a helper function to AddressOfOp that computes if it references a "DSOLocalEquivalent" and use this in the export to create the correct constant type. That way we avoid having two ops that model basically the same thing. 

Alternatively, we may have to introduce a DSOLocalSymbolRefAttr or similar so that we can reliable materialize the correct op type. Even then it may make sense to still use AddressOfOp to have one way of referencing a symbol. 

I think I favor computing this property from the IR if this is possible. 









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


More information about the Mlir-commits mailing list