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

Bruno Cardoso Lopes llvmlistbot at llvm.org
Fri Mar 21 12:31:02 PDT 2025


================
@@ -1213,6 +1213,17 @@ def LLVM_UndefAttr : LLVM_Attr<"Undef", "undef">;
 /// Folded into from LLVM::PoisonOp.
 def LLVM_PoisonAttr : LLVM_Attr<"Poison", "poison">;
 
+//===----------------------------------------------------------------------===//
+// DSOLocalEquivalentAttr
+//===----------------------------------------------------------------------===//
+
+/// Folded into from LLVM::DSOLocalEquivalentOp.
+def LLVM_DSOLocalEquivalentAttr : LLVM_Attr<"DSOLocalEquivalent",
+                                            "dso_local_equivalent"> {
----------------
bcardosolopes wrote:

I tried this - it builds fine but the problem is in the `::get` methods, `DSOLocalEquivalentAttr` won't get something resembling the base class getters, so we end up only really able to do `DSOLocalEquivalentAttr::get(getContext())`, which doesn't setup any symbol. I also didn't find a clean way to set up the symbol after such instantiation.

Alternatively, if we add an extra param for the name, then what's the point of having the inheritance, it will store two strings (with the `FlatSymbolRefAttr` one empty).

I'm gonna move forward with passing a `FlatSymbolRefAttr` as param, if you can show me an example on how to use inheritance in a clean way I'm happy to tackle that in other PRs.

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


More information about the Mlir-commits mailing list