From d7f288502fcacfb261a03d12cdf2261d3425815a Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Tue, 17 Aug 2021 18:20:04 +0100 Subject: [PATCH] SelectionDAGBuilder::visitInlineAsm - don't dereference dyn_cast<> results. dyn_cast<> can return nullptr if the cast is illegal, use cast<> instead which will assert that the cast is correct. Fixes static analyser warning. --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 57fe970..eb27735 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -8708,7 +8708,7 @@ void SelectionDAGBuilder::visitInlineAsm(const CallBase &Call, MachineFunction &MF = DAG.getMachineFunction(); MachineRegisterInfo &MRI = MF.getRegInfo(); const TargetRegisterInfo &TRI = *MF.getSubtarget().getRegisterInfo(); - RegisterSDNode *R = dyn_cast(AsmNodeOperands[CurOp+1]); + auto *R = cast(AsmNodeOperands[CurOp+1]); Register TiedReg = R->getReg(); MVT RegVT = R->getSimpleValueType(0); const TargetRegisterClass *RC = TiedReg.isVirtual() ? -- 2.7.4