[llvm] 91865ac - Use isa instead of !dyn_cast (#137344)

via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 25 10:11:59 PDT 2025


Author: Matt Arsenault
Date: 2025-04-25T19:11:56+02:00
New Revision: 91865ac9ba08d142646f1bc6fa7f1ba0b39841ef

URL: https://github.com/llvm/llvm-project/commit/91865ac9ba08d142646f1bc6fa7f1ba0b39841ef
DIFF: https://github.com/llvm/llvm-project/commit/91865ac9ba08d142646f1bc6fa7f1ba0b39841ef.diff

LOG: Use isa instead of !dyn_cast (#137344)

Added: 
    

Modified: 
    llvm/lib/IR/Instruction.cpp
    llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp

Removed: 
    


################################################################################
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