From 2e9ddcc30e846687c9c0112d3ae32acccc9757bb Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Wed, 27 Mar 2019 18:14:02 +0000 Subject: RegPressure: Fix crash on blocks with only dbg_value If there were only dbg_values in the block, recede would hit the beginning of the block and try to use thet dbg_value as a real instruction. llvm-svn: 357105 --- llvm/lib/CodeGen/RegisterPressure.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/RegisterPressure.cpp') diff --git a/llvm/lib/CodeGen/RegisterPressure.cpp b/llvm/lib/CodeGen/RegisterPressure.cpp index dafd95fa7d5..7d9b3aa9b2d 100644 --- a/llvm/lib/CodeGen/RegisterPressure.cpp +++ b/llvm/lib/CodeGen/RegisterPressure.cpp @@ -845,7 +845,7 @@ void RegPressureTracker::recedeSkipDebugValues() { CurrPos = skipDebugInstructionsBackward(std::prev(CurrPos), MBB->begin()); SlotIndex SlotIdx; - if (RequireIntervals) + if (RequireIntervals && !CurrPos->isDebugInstr()) SlotIdx = LIS->getInstructionIndex(*CurrPos).getRegSlot(); // Open the top of the region using slot indexes. @@ -855,6 +855,12 @@ void RegPressureTracker::recedeSkipDebugValues() { void RegPressureTracker::recede(SmallVectorImpl *LiveUses) { recedeSkipDebugValues(); + if (CurrPos->isDebugValue()) { + // It's possible to only have debug_value instructions and hit the start of + // the block. + assert(CurrPos == MBB->begin()); + return; + } const MachineInstr &MI = *CurrPos; RegisterOperands RegOpers; -- cgit v1.2.3