[RISC] Replace dyn_casts that are only checked by an assert with a cast. NFC
authorCraig Topper <craig.topper@sifive.com>
Sun, 17 Jan 2021 04:23:41 +0000 (20:23 -0800)
committerCraig Topper <craig.topper@sifive.com>
Sun, 17 Jan 2021 04:23:48 +0000 (20:23 -0800)
llvm/utils/TableGen/RISCVCompressInstEmitter.cpp

index 9fcb6a1..3e20a72 100644 (file)
@@ -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