[llvm] [LLVM] remove redundant uses of dyn_cast (NFC) (PR #189105)

Henrik G. Olsson via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 27 13:48:25 PDT 2026


================
@@ -7655,7 +7655,7 @@ static bool isARMMCExpr(MCParsedAsmOperand &MCOp) {
   const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(Op.getImm());
   if (CE)
     return false;
-  const MCExpr *E = dyn_cast<MCExpr>(Op.getImm());
+  const MCExpr *E = Op.getImm();
   if (!E)
     return false;
----------------
hnrklssn wrote:

@stuij I left these null checks in despite them being seemingly unused (if `Op.getImm()` were null, you'd have to use `dyn_cast_or_null` rather than `dyn_cast`) because it seemed like the code was there for a reason. But this is either just dead code, or the function is buggy somehow.

https://github.com/llvm/llvm-project/pull/189105


More information about the llvm-commits mailing list