[PATCH] D131544: [LegalizeTypes][NFC] Use dyn_cast instead of isa and cast.

WangLian via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 23:59:52 PDT 2022


Jimerlife created this revision.
Jimerlife added reviewers: craig.topper, sdesmalen, frasercrmck, benshi001.
Jimerlife added a project: LLVM.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
Jimerlife requested review of this revision.
Herald added subscribers: llvm-commits, jacquesguan.

Use dyn_cast<> instead of isa<> and cast<>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131544

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
@@ -3033,8 +3033,8 @@
   SDValue Idx = N->getOperand(1);
   EVT VecVT = Vec.getValueType();
 
-  if (isa<ConstantSDNode>(Idx)) {
-    uint64_t IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
+  if (auto * Index = dyn_cast<ConstantSDNode>(Idx)) {
+    uint64_t IdxVal = Index->getZExtValue();
 
     SDValue Lo, Hi;
     GetSplitVector(Vec, Lo, Hi);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131544.451362.patch
Type: text/x-patch
Size: 598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220810/cd122877/attachment.bin>


More information about the llvm-commits mailing list