[flang-commits] [flang] [flang] Migrate away from PointerUnion::{is, get} (NFC) (PR #122585)
via flang-commits
flang-commits at lists.llvm.org
Sat Jan 11 00:39:49 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-fir-hlfir
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
Note that PointerUnion::{is,get} have 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>
---
Full diff: https://github.com/llvm/llvm-project/pull/122585.diff
2 Files Affected:
- (modified) flang/include/flang/Optimizer/Dialect/CUF/CUFOps.td (+2-1)
- (modified) flang/include/flang/Optimizer/Dialect/FIROps.td (+3-2)
``````````diff
diff --git a/flang/include/flang/Optimizer/Dialect/CUF/CUFOps.td b/flang/include/flang/Optimizer/Dialect/CUF/CUFOps.td
index 9a31ffa2e94712..6f886726b12834 100644
--- a/flang/include/flang/Optimizer/Dialect/CUF/CUFOps.td
+++ b/flang/include/flang/Optimizer/Dialect/CUF/CUFOps.td
@@ -222,7 +222,8 @@ def cuf_KernelLaunchOp : cuf_Op<"kernel_launch", [CallOpInterface,
}
void setCalleeFromCallable(mlir::CallInterfaceCallable callee) {
- (*this)->setAttr(getCalleeAttrName(), callee.get<mlir::SymbolRefAttr>());
+ (*this)->setAttr(getCalleeAttrName(),
+ llvm::cast<mlir::SymbolRefAttr>(callee));
}
mlir::FunctionType getFunctionType();
diff --git a/flang/include/flang/Optimizer/Dialect/FIROps.td b/flang/include/flang/Optimizer/Dialect/FIROps.td
index 01f588b3c8ba5f..5f0f0b48e892b9 100644
--- a/flang/include/flang/Optimizer/Dialect/FIROps.td
+++ b/flang/include/flang/Optimizer/Dialect/FIROps.td
@@ -2488,8 +2488,9 @@ def fir_CallOp : fir_Op<"call",
void setCalleeFromCallable(mlir::CallInterfaceCallable callee) {
if (auto calling =
(*this)->getAttrOfType<mlir::SymbolRefAttr>(getCalleeAttrName()))
- (*this)->setAttr(getCalleeAttrName(), callee.get<mlir::SymbolRefAttr>());
- setOperand(0, callee.get<mlir::Value>());
+ (*this)->setAttr(getCalleeAttrName(),
+ llvm::cast<mlir::SymbolRefAttr>(callee));
+ setOperand(0, llvm::cast<mlir::Value>(callee));
}
}];
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/122585
More information about the flang-commits
mailing list