[PATCH] D147923: Change dyn_cast to cast

Bing Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 02:16:39 PDT 2023


yubing created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
yubing requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147923

Files:
  llvm/lib/CodeGen/WinEHPrepare.cpp
  llvm/utils/TableGen/AsmWriterEmitter.cpp


Index: llvm/utils/TableGen/AsmWriterEmitter.cpp
===================================================================
--- llvm/utils/TableGen/AsmWriterEmitter.cpp
+++ llvm/utils/TableGen/AsmWriterEmitter.cpp
@@ -1006,7 +1006,7 @@
         bool IsOr = CombineType == "any_of";
         // Change (any_of FeatureAll, (any_of ...)) to (any_of FeatureAll, ...).
         if (IsOr && D->getNumArgs() == 2 && isa<DagInit>(D->getArg(1))) {
-          DagInit *RHS = dyn_cast<DagInit>(D->getArg(1));
+          DagInit *RHS = cast<DagInit>(D->getArg(1));
           SmallVector<Init *> Args{D->getArg(0)};
           SmallVector<StringInit *> ArgNames{D->getArgName(0)};
           for (unsigned i = 0, e = RHS->getNumArgs(); i != e; ++i) {
Index: llvm/lib/CodeGen/WinEHPrepare.cpp
===================================================================
--- llvm/lib/CodeGen/WinEHPrepare.cpp
+++ llvm/lib/CodeGen/WinEHPrepare.cpp
@@ -250,7 +250,7 @@
       // Retrive the new State
       State = EHInfo.CxxUnwindMap[State].ToState; // Retrive next State
     } else if (isa<InvokeInst>(TI)) {
-      auto *Call = dyn_cast<CallBase>(TI);
+      auto *Call = cast<CallBase>(TI);
       const Function *Fn = Call->getCalledFunction();
       if (Fn && Fn->isIntrinsic() &&
           (Fn->getIntrinsicID() == Intrinsic::seh_scope_begin ||
@@ -318,7 +318,7 @@
       // Retrive the new State.
       State = EHInfo.SEHUnwindMap[State].ToState; // Retrive next State
     } else if (isa<InvokeInst>(TI)) {
-      auto *Call = dyn_cast<CallBase>(TI);
+      auto *Call = cast<CallBase>(TI);
       const Function *Fn = Call->getCalledFunction();
       if (Fn && Fn->isIntrinsic() &&
           Fn->getIntrinsicID() == Intrinsic::seh_try_begin)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147923.512100.patch
Type: text/x-patch
Size: 1726 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230410/e8c3f95f/attachment.bin>


More information about the llvm-commits mailing list