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
This commit is contained in:
Andrew Trick 2013-04-24 23:19:56 +00:00
parent 2871ba90a3
commit a264a20277

View File

@ -933,6 +933,8 @@ namespace {
class CopyConstrain : public ScheduleDAGMutation { class CopyConstrain : public ScheduleDAGMutation {
// Transient state. // Transient state.
SlotIndex RegionBeginIdx; 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; SlotIndex RegionEndIdx;
public: public:
CopyConstrain(const TargetInstrInfo *, const TargetRegisterInfo *) {} 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 /// \brief Callback from DAG postProcessing to create weak edges to encourage
/// copy elimination. /// copy elimination.
void CopyConstrain::apply(ScheduleDAGMI *DAG) { void CopyConstrain::apply(ScheduleDAGMI *DAG) {
RegionBeginIdx = DAG->getLIS()->getInstructionIndex( MachineBasicBlock::iterator FirstPos = nextIfDebug(DAG->begin(), DAG->end());
&*nextIfDebug(DAG->begin(), DAG->end())); if (FirstPos == DAG->end())
return;
RegionBeginIdx = DAG->getLIS()->getInstructionIndex(&*FirstPos);
RegionEndIdx = DAG->getLIS()->getInstructionIndex( RegionEndIdx = DAG->getLIS()->getInstructionIndex(
&*priorNonDebug(DAG->end(), DAG->begin())); &*priorNonDebug(DAG->end(), DAG->begin()));