[Mlir-commits] [mlir] 98534ee - [mlir] Migrate away from PointerUnion::dyn_cast (NFC) (#135770)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Apr 15 09:10:22 PDT 2025


Author: Kazu Hirata
Date: 2025-04-15T09:10:19-07:00
New Revision: 98534eee847dfa80ff88b213a628a6149f8754d9

URL: https://github.com/llvm/llvm-project/commit/98534eee847dfa80ff88b213a628a6149f8754d9
DIFF: https://github.com/llvm/llvm-project/commit/98534eee847dfa80ff88b213a628a6149f8754d9.diff

LOG: [mlir] Migrate away from PointerUnion::dyn_cast (NFC) (#135770)

Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:

  // FIXME: Replace the uses of is(), get() and dyn_cast() with
  //        isa<T>, cast<T> and the llvm::dyn_cast<T>

Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast
because we have a call to dyn_cast earlier in the function, implying
that attrOrProp is nonnull.

Added: 
    

Modified: 
    mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
index 2431807ce463d..edcb2f507ae50 100644
--- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
@@ -1828,7 +1828,7 @@ void OpEmitter::genPropertiesSupportForBytecode(
           name, tgfmt(namedProperty->prop.getWriteToMlirBytecodeCall(), &fctx));
       continue;
     }
-    const auto *namedAttr = attrOrProp.dyn_cast<const AttributeMetadata *>();
+    const auto *namedAttr = dyn_cast<const AttributeMetadata *>(attrOrProp);
     StringRef name = namedAttr->attrName;
     if (namedAttr->isRequired) {
       readPropertiesMethod << formatv(R"(


        


More information about the Mlir-commits mailing list