[Mlir-commits] [mlir] [mlir] Migrate away from PointerUnion::dyn_cast (NFC) (PR #123693)
Nikita Popov
llvmlistbot at llvm.org
Tue Jan 21 07:39:17 PST 2025
https://github.com/nikic requested changes to this pull request.
Our general porting approach for this should be to always use dyn_cast (or cast) rather than dyn_cast_if_present if it's possible. Existing uses of `PointerUnion::dyn_cast` use it as the only available option, not as an explicit statement that they want dyn_cast_if_present behavior. Porting this to dyn_cast_if_present where null is not actually possible makes for confusing code, because now you explicitly make it look like null is a possible value that needs to be handled. For most (if not all) of the uses in this PR, null is not possible because there is a cast<> on the else path.
If we just blindly migrate dyn_cast -> dyn_cast_if_present, we're making code quality worse, not better.
https://github.com/llvm/llvm-project/pull/123693
More information about the Mlir-commits
mailing list