X86: Use dyn_cast instead of isa+cast, NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 23 Jul 2015 19:27:07 +0000 (19:27 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 23 Jul 2015 19:27:07 +0000 (19:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243034 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/AsmParser/X86AsmParser.cpp

index e9f859abf7bbac37ac81ce67b12e43f0a18afac6..3f5e076f8480d047ff8062b987811eb36e33a324 100644 (file)
@@ -2347,11 +2347,12 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
   // instalias with an immediate operand yet.
   if (Name == "int" && Operands.size() == 2) {
     X86Operand &Op1 = static_cast<X86Operand &>(*Operands[1]);
-    if (Op1.isImm() && isa<MCConstantExpr>(Op1.getImm()) &&
-        cast<MCConstantExpr>(Op1.getImm())->getValue() == 3) {
-      Operands.erase(Operands.begin() + 1);
-      static_cast<X86Operand &>(*Operands[0]).setTokenValue("int3");
-    }
+    if (Op1.isImm())
+      if (auto *CE = dyn_cast<MCConstantExpr>(Op1.getImm()))
+        if (CE->getValue() == 3) {
+          Operands.erase(Operands.begin() + 1);
+          static_cast<X86Operand &>(*Operands[0]).setTokenValue("int3");
+        }
   }
 
   return false;