summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2010-04-06 21:59:56 +0000
committerDale Johannesen <dalej@apple.com>2010-04-06 21:59:56 +0000
commitd1976e35c47153e9e8515394257ca336b45e6fe2 (patch)
treedcdfc03b910158ce7c1e023b423d9d3293b4835b /llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
parent4bd3dd956f69f6a6f5bfde04ea4a1acbff9a1183 (diff)
downloadbcm5719-llvm-d1976e35c47153e9e8515394257ca336b45e6fe2.tar.gz
bcm5719-llvm-d1976e35c47153e9e8515394257ca336b45e6fe2.zip
Allow for the possibility that a debug-value points
to a SDNode that didn't have code generated for it. llvm-svn: 100566
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp b/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
index 28ba343e7fe..de8f1a06fe7 100644
--- a/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
@@ -517,8 +517,19 @@ MachineInstr *InstrEmitter::EmitDbgValue(SDDbgValue *SD,
const TargetInstrDesc &II = TII->get(TargetOpcode::DBG_VALUE);
MachineInstrBuilder MIB = BuildMI(*MF, DL, II);
if (SD->getKind() == SDDbgValue::SDNODE) {
- AddOperand(&*MIB, SDValue(SD->getSDNode(), SD->getResNo()),
- (*MIB).getNumOperands(), &II, VRBaseMap, true /*IsDebug*/);
+ SDNode *Node = SD->getSDNode();
+ SDValue Op = SDValue(Node, SD->getResNo());
+ // It's possible we replaced this SDNode with other(s) and therefore
+ // didn't generate code for it. It's better to catch these cases where
+ // they happen and transfer the debug info, but trying to guarantee that
+ // in all cases would be very fragile; this is a safeguard for any
+ // that were missed.
+ DenseMap<SDValue, unsigned>::iterator I = VRBaseMap.find(Op);
+ if (I==VRBaseMap.end())
+ MIB.addReg(0U); // undef
+ else
+ AddOperand(&*MIB, Op, (*MIB).getNumOperands(), &II, VRBaseMap,
+ true /*IsDebug*/);
} else if (SD->getKind() == SDDbgValue::CONST) {
Value *V = SD->getConst();
if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
OpenPOWER on IntegriCloud