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

WangLian via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 11 21:13:33 PDT 2022


Jimerlife updated this revision to Diff 452073.
Jimerlife added a comment.

update and add `const` keyword


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131544/new/

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 (const ConstantSDNode *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.452073.patch
Type: text/x-patch
Size: 613 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220812/6eafa3de/attachment.bin>


More information about the llvm-commits mailing list