diff options
author | Andrew Trick <atrick@apple.com> | 2013-04-24 23:19:56 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2013-04-24 23:19:56 +0000 |
commit | a264a20277a4699cdc44092767228b76234016d9 (patch) | |
tree | 1925fbf794f28bf93ab7fd000a9947410cbad09d /lib | |
parent | 2871ba90a3d3544fa1f136c7d4efbb619298d6e8 (diff) | |
download | external_llvm-a264a20277a4699cdc44092767228b76234016d9.zip external_llvm-a264a20277a4699cdc44092767228b76234016d9.tar.gz external_llvm-a264a20277a4699cdc44092767228b76234016d9.tar.bz2 |
Fix for r180193 - MI Sched: eliminate local vreg.
Fixes PR15838. Need to check for blocks with nothing but dbg.value.
I'm not sure how to force this situation with a unit test. I tried to
reduce the test case in PR15838 (1k lines of metadata) but gave up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180227 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/MachineScheduler.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/CodeGen/MachineScheduler.cpp b/lib/CodeGen/MachineScheduler.cpp index c4937a2..32aedbe 100644 --- a/lib/CodeGen/MachineScheduler.cpp +++ b/lib/CodeGen/MachineScheduler.cpp @@ -933,6 +933,8 @@ namespace { class CopyConstrain : public ScheduleDAGMutation { // Transient state. SlotIndex RegionBeginIdx; + // RegionEndIdx is the slot index of the last non-debug instruction in the + // scheduling region. So we may have RegionBeginIdx == RegionEndIdx. SlotIndex RegionEndIdx; public: CopyConstrain(const TargetInstrInfo *, const TargetRegisterInfo *) {} @@ -1082,8 +1084,10 @@ void CopyConstrain::constrainLocalCopy(SUnit *CopySU, ScheduleDAGMI *DAG) { /// \brief Callback from DAG postProcessing to create weak edges to encourage /// copy elimination. void CopyConstrain::apply(ScheduleDAGMI *DAG) { - RegionBeginIdx = DAG->getLIS()->getInstructionIndex( - &*nextIfDebug(DAG->begin(), DAG->end())); + MachineBasicBlock::iterator FirstPos = nextIfDebug(DAG->begin(), DAG->end()); + if (FirstPos == DAG->end()) + return; + RegionBeginIdx = DAG->getLIS()->getInstructionIndex(&*FirstPos); RegionEndIdx = DAG->getLIS()->getInstructionIndex( &*priorNonDebug(DAG->end(), DAG->begin())); |