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

Asher Mancinelli llvmlistbot at llvm.org
Fri Dec 19 08:30:13 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);
----------------
ashermancinelli wrote:

I checked again to be sure, but I believe this gets at the concern I put in the description--I can use SymbolOpInterface to get the mlir symbol-table visibility, but I don't see such an interface for the LLVM visibility, which is what I need for this pass. For example, if I look for ops conforming to SymbolOpInterface and get their visibility in the test case, every symbol op's visibility is public even if their LLVM::VisibilityAttr's value is protected/hidden. Does this make sense? Am I misunderstanding your suggestion?

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


More information about the Mlir-commits mailing list