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 | 2e87517144e4b66d95e96c7e412d43d3eed992c3 (patch) | |
tree | aded2251cee070e7e04354dfb871ab5ff2b1bd7f /llvm/lib | |
parent | 108d5a61b7903a6f68235fc2fd6bee9e31975c8c (diff) | |
download | bcm5719-llvm-2e87517144e4b66d95e96c7e412d43d3eed992c3.tar.gz bcm5719-llvm-2e87517144e4b66d95e96c7e412d43d3eed992c3.zip |
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.
llvm-svn: 180227
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/MachineScheduler.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp index c4937a2ecf7..32aedbee946 100644 --- a/llvm/lib/CodeGen/MachineScheduler.cpp +++ b/llvm/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())); |