[llvm] d7f2885 - SelectionDAGBuilder::visitInlineAsm - don't dereference dyn_cast<> results.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 17 10:41:15 PDT 2021
Author: Simon Pilgrim
Date: 2021-08-17T18:40:59+01:00
New Revision: d7f288502fcacfb261a03d12cdf2261d3425815a
URL: https://github.com/llvm/llvm-project/commit/d7f288502fcacfb261a03d12cdf2261d3425815a
DIFF: https://github.com/llvm/llvm-project/commit/d7f288502fcacfb261a03d12cdf2261d3425815a.diff
LOG: 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.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 57fe9708d052..eb2773580e04 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<RegisterSDNode>(AsmNodeOperands[CurOp+1]);
+ auto *R = cast<RegisterSDNode>(AsmNodeOperands[CurOp+1]);
Register TiedReg = R->getReg();
MVT RegVT = R->getSimpleValueType(0);
const TargetRegisterClass *RC = TiedReg.isVirtual() ?
More information about the llvm-commits
mailing list