[Mlir-commits] [mlir] [MLIR][LLVM] Fix uses of LLVM's visibility attr (PR #173024)

Mehdi Amini llvmlistbot at llvm.org
Fri Dec 19 08:36:16 PST 2025


================
@@ -22,11 +22,12 @@ using namespace mlir;
 
 static void updateVisibility(Operation *op,
                              LLVM::VisibilityAttr newVisibilityAttr) {
+  static constexpr char visibilityAttrName[] = "visibility_";
   if (auto visibilityAttr =
-          op->getAttrOfType<LLVM::VisibilityAttr>(LLVM::VisibilityAttr::name)) {
+          op->getAttrOfType<LLVM::VisibilityAttr>(visibilityAttrName)) {
     LLVM::Visibility visibility = visibilityAttr.getValue();
     if (visibility == LLVM::Visibility::Default) {
-      op->setAttr(LLVM::VisibilityAttr::name, newVisibilityAttr);
+      op->setAttr(visibilityAttrName, newVisibilityAttr);
----------------
joker-eph wrote:

Oh I see, the term "visibility" is overloaded here unfortunately... The SymbolOpInterface won't help.
I would think that this would then requires a TypeSwitch on the concrete LLVM ops and directly use the getVisibility accessor there (templating the function should work).

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


More information about the Mlir-commits mailing list