[llvm] 64591f2 - [TableGen] Replace static_cast with llvm's cast. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 16 00:30:13 PDT 2021


Author: Craig Topper
Date: 2021-10-16T00:27:53-07:00
New Revision: 64591f217d984e955c27942437117f9ee5af570c

URL: https://github.com/llvm/llvm-project/commit/64591f217d984e955c27942437117f9ee5af570c
DIFF: https://github.com/llvm/llvm-project/commit/64591f217d984e955c27942437117f9ee5af570c.diff

LOG: [TableGen] Replace static_cast with llvm's cast. NFC

These all appear next to an isa<> and cast<> is much more
common in these cases.

Added: 
    

Modified: 
    llvm/utils/TableGen/CodeGenDAGPatterns.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index 2d0694dbc2e9b..4a247050ceebe 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -1632,12 +1632,12 @@ bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N,
     // have an integer type that is smaller than the VT.
     if (!NodeToApply->isLeaf() ||
         !isa<DefInit>(NodeToApply->getLeafValue()) ||
-        !static_cast<DefInit*>(NodeToApply->getLeafValue())->getDef()
+        !cast<DefInit>(NodeToApply->getLeafValue())->getDef()
                ->isSubClassOf("ValueType")) {
       TP.error(N->getOperator()->getName() + " expects a VT operand!");
       return false;
     }
-    DefInit *DI = static_cast<DefInit*>(NodeToApply->getLeafValue());
+    DefInit *DI = cast<DefInit>(NodeToApply->getLeafValue());
     const CodeGenTarget &T = TP.getDAGPatterns().getTargetInfo();
     auto VVT = getValueTypeByHwMode(DI->getDef(), T.getHwModes());
     TypeSetByHwMode TypeListTmp(VVT);
@@ -3832,7 +3832,7 @@ void CodeGenDAGPatterns::parseInstructionPattern(
     InstInputs.erase(OpName);   // It occurred, remove from map.
 
     if (InVal->isLeaf() && isa<DefInit>(InVal->getLeafValue())) {
-      Record *InRec = static_cast<DefInit*>(InVal->getLeafValue())->getDef();
+      Record *InRec = cast<DefInit>(InVal->getLeafValue())->getDef();
       if (!checkOperandClass(Op, InRec))
         I.error("Operand $" + OpName + "'s register class disagrees"
                  " between the operand and pattern");


        


More information about the llvm-commits mailing list