[llvm-branch-commits] [llvm] 97f7e4e - [RISC] Replace dyn_casts that are only checked by an assert with a cast. NFC

Craig Topper via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Jan 16 21:33:43 PST 2021


Author: Craig Topper
Date: 2021-01-16T20:23:48-08:00
New Revision: 97f7e4e8c9309e0806f9b8f8afcf8ce2ef63656c

URL: https://github.com/llvm/llvm-project/commit/97f7e4e8c9309e0806f9b8f8afcf8ce2ef63656c
DIFF: https://github.com/llvm/llvm-project/commit/97f7e4e8c9309e0806f9b8f8afcf8ce2ef63656c.diff

LOG: [RISC] Replace dyn_casts that are only checked by an assert with a cast. NFC

Added: 
    

Modified: 
    llvm/utils/TableGen/RISCVCompressInstEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/RISCVCompressInstEmitter.cpp b/llvm/utils/TableGen/RISCVCompressInstEmitter.cpp
index 9fcb6a168c3f..3e20a726866d 100644
--- a/llvm/utils/TableGen/RISCVCompressInstEmitter.cpp
+++ b/llvm/utils/TableGen/RISCVCompressInstEmitter.cpp
@@ -284,11 +284,7 @@ static bool verifyDagOpCount(CodeGenInstruction &Inst, DagInit *Dag,
 }
 
 static bool validateArgsTypes(Init *Arg1, Init *Arg2) {
-  DefInit *Type1 = dyn_cast<DefInit>(Arg1);
-  DefInit *Type2 = dyn_cast<DefInit>(Arg2);
-  assert(Type1 && ("Arg1 type not found\n"));
-  assert(Type2 && ("Arg2 type not found\n"));
-  return Type1->getDef() == Type2->getDef();
+  return cast<DefInit>(Arg1)->getDef() == cast<DefInit>(Arg2)->getDef();
 }
 
 // Creates a mapping between the operand name in the Dag (e.g. $rs1) and


        


More information about the llvm-branch-commits mailing list