Skip to content

Conversation

CoTinker
Copy link
Contributor

@CoTinker CoTinker commented Jul 24, 2025

This PR uses val.getDefiningOp<OpTy>() to replace dyn_cast<OpTy>(val.getDefiningOp()) , dyn_cast_or_null<OpTy>(val.getDefiningOp()) and dyn_cast_if_present<OpTy>(val.getDefiningOp()).

@kuhar
Copy link
Member

kuhar commented Jul 24, 2025

BTW, we could do a similar cleanup for dyn_cast<T>(typeConverter->convertType(foo)) --> typeConverter->convertType<T>(foo)

@CoTinker
Copy link
Contributor Author

BTW, we could do a similar cleanup for dyn_cast<T>(typeConverter->convertType(foo)) --> typeConverter->convertType<T>(foo)

Great, I'm glad to do that in another PR. Thanks for your advice.

…tDefiningOp())`

This PR uses `val.getDefiningOp<OpTy>()` to replace `dyn_cast<OpTy>(val.getDefiningOp())`
, `dyn_cast_or_null<OpTy>(val.getDefiningOp())` and `dyn_cast_if_present<OpTy>(val.getDefiningOp())`.
@CoTinker CoTinker force-pushed the dyn_cast_defining branch from df7a99f to 766bb8a Compare July 24, 2025 14:40
Copy link
Member

@rengolin rengolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice cleanup!

Copy link
Collaborator

@joker-eph joker-eph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

It would be great to have a clang-tidy check for this.

@CoTinker CoTinker merged commit f047b73 into llvm:main Jul 25, 2025
9 checks passed
@CoTinker CoTinker deleted the dyn_cast_defining branch July 25, 2025 02:35
searlmc1 pushed a commit to ROCm/llvm-project that referenced this pull request Jul 25, 2025
…OpTy>(getDefiningOp())` (llvm#150428)"

seems to break
declare-target-and-explicit-map
declare-target-and-implicit-and-explicit-map
declare-target-link-1
declare-target-link-2
declare-target-link-3

This reverts commit f047b73.
xlauko added a commit to llvm/clangir that referenced this pull request Jul 27, 2025
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Jul 28, 2025
…tDefiningOp())` (llvm#150428)

This PR uses `val.getDefiningOp<OpTy>()` to replace `dyn_cast<OpTy>(val.getDefiningOp())` , `dyn_cast_or_null<OpTy>(val.getDefiningOp())` and `dyn_cast_if_present<OpTy>(val.getDefiningOp())`.
xlauko added a commit to llvm/clangir that referenced this pull request Jul 29, 2025
xlauko added a commit to llvm/clangir that referenced this pull request Jul 29, 2025
xlauko added a commit to llvm/clangir that referenced this pull request Jul 29, 2025
xlauko added a commit that referenced this pull request Jul 29, 2025
xlauko added a commit that referenced this pull request Aug 2, 2025
xlauko added a commit that referenced this pull request Aug 2, 2025
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Aug 2, 2025
…getDefiningOp()) (NFC) (#151217)

This applies similar changes to llvm/llvm-project#150428
lanza pushed a commit to lanza/llvm-project that referenced this pull request Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants