summaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2013-10-05 00:08:27 +0000
committerAdrian Prantl <aprantl@apple.com>2013-10-05 00:08:27 +0000
commiteacbfd1d512b97b5551ce9f30bf85ba000d9da42 (patch)
treee4f6744074ec008a4fe1f9b3b3d72eec88ee560f /lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
parent22852c76f5791f98aadb176ebcf15af5217a67eb (diff)
downloadllvm-eacbfd1d512b97b5551ce9f30bf85ba000d9da42.tar.gz
llvm-eacbfd1d512b97b5551ce9f30bf85ba000d9da42.tar.bz2
llvm-eacbfd1d512b97b5551ce9f30bf85ba000d9da42.tar.xz
Debug info: Don't crash in SelectionDAGISel when a vreg that is being
pointed to by a dbg_value belonging to a function argument is eliminated during instruction selection. rdar://problem/15094721. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192011 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index fcde6b5b93..1d0ed3af45 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -408,9 +408,13 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) {
EntryMBB->insert(EntryMBB->begin(), MI);
else {
MachineInstr *Def = RegInfo->getVRegDef(Reg);
- MachineBasicBlock::iterator InsertPos = Def;
- // FIXME: VR def may not be in entry block.
- Def->getParent()->insert(llvm::next(InsertPos), MI);
+ if (Def) {
+ MachineBasicBlock::iterator InsertPos = Def;
+ // FIXME: VR def may not be in entry block.
+ Def->getParent()->insert(llvm::next(InsertPos), MI);
+ } else
+ DEBUG(dbgs() << "Dropping debug info for dead vreg"
+ << TargetRegisterInfo::virtReg2Index(Reg) << "\n");
}
// If Reg is live-in then update debug info to track its copy in a vreg.