[llvm] Use isa instead of !dyn_cast (PR #137344)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 25 08:29:34 PDT 2025
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/137344
None
>From 68dcdca0191e446ef089b8a096edd3ed65fc414e Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 25 Apr 2025 17:27:53 +0200
Subject: [PATCH] Use isa instead of !dyn_cast
---
llvm/lib/IR/Instruction.cpp | 2 +-
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 2 +-
llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index 4eadecb54feb5..e55a4b41e4d00 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -490,7 +490,7 @@ bool Instruction::hasNonDebugLocLoopMetadata() const {
// the first item because it is a self-reference.
for (const MDOperand &Op : llvm::drop_begin(LoopMD->operands())) {
// check for debug location type by attempting a cast.
- if (!dyn_cast<DILocation>(Op)) {
+ if (!isa<DILocation>(Op)) {
return true;
}
}
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 1192501e7799c..4bcefae8aed03 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -8751,7 +8751,7 @@ foldBinOpIntoSelectIfProfitable(SDNode *BO, SelectionDAG &DAG,
unsigned ConstSelOpNo = 1;
unsigned OtherSelOpNo = 2;
- if (!dyn_cast<ConstantSDNode>(Sel->getOperand(ConstSelOpNo))) {
+ if (!isa<ConstantSDNode>(Sel->getOperand(ConstSelOpNo))) {
ConstSelOpNo = 2;
OtherSelOpNo = 1;
}
diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
index 8ddfe46e7aae0..c9942b29a6f43 100644
--- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -1656,7 +1656,7 @@ class StrlenVerifier {
// We only want RecAddExpr with recurrence step that is constant. This
// is good enough for all the idioms we want to recognize. Later we expand
// and materialize the recurrence as {base,+,a} -> (base + a * strlen)
- if (!dyn_cast<SCEVConstant>(AddRecEv->getStepRecurrence(*SE)))
+ if (!isa<SCEVConstant>(AddRecEv->getStepRecurrence(*SE)))
return false;
}
More information about the llvm-commits
mailing list