[llvm] 114e712 - InstrEmitter.cpp - don't dereference a dyn_cast<>.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 8 09:59:31 PDT 2021
Author: Simon Pilgrim
Date: 2021-06-08T17:59:04+01:00
New Revision: 114e712c344fbf8361b97130e78baa2624ff9bca
URL: https://github.com/llvm/llvm-project/commit/114e712c344fbf8361b97130e78baa2624ff9bca
DIFF: https://github.com/llvm/llvm-project/commit/114e712c344fbf8361b97130e78baa2624ff9bca.diff
LOG: InstrEmitter.cpp - don't dereference a dyn_cast<>.
dyn_cast<> can return nullptr which we would then dereference - use cast<> which will assert that the type is correct.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp b/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
index 691cdc9662c9..017231c1ab58 100644
--- a/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
@@ -1144,10 +1144,10 @@ EmitSpecialNode(SDNode *Node, bool IsClone, bool IsCloned,
case ISD::LIFETIME_START:
case ISD::LIFETIME_END: {
- unsigned TarOp = (Node->getOpcode() == ISD::LIFETIME_START) ?
- TargetOpcode::LIFETIME_START : TargetOpcode::LIFETIME_END;
-
- FrameIndexSDNode *FI = dyn_cast<FrameIndexSDNode>(Node->getOperand(1));
+ unsigned TarOp = (Node->getOpcode() == ISD::LIFETIME_START)
+ ? TargetOpcode::LIFETIME_START
+ : TargetOpcode::LIFETIME_END;
+ auto *FI = cast<FrameIndexSDNode>(Node->getOperand(1));
BuildMI(*MBB, InsertPos, Node->getDebugLoc(), TII->get(TarOp))
.addFrameIndex(FI->getIndex());
break;
More information about the llvm-commits
mailing list