diff options
author | Hal Finkel <hfinkel@anl.gov> | 2011-12-02 04:58:07 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2011-12-02 04:58:07 +0000 |
commit | db809e0eb7055a5247c80500fe0ba0ac22199722 (patch) | |
tree | ea42f13f90f796301a5fd20fb4c28b0a9addf969 /lib/CodeGen | |
parent | 64c34e253563a8ba6b41fbce2bb020632cf65961 (diff) |
make sure ScheduleDAGInstrs::EmitSchedule does not crash when the first instruction in Sequence is a Noop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145677 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/ScheduleDAGInstrs.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/CodeGen/ScheduleDAGInstrs.cpp b/lib/CodeGen/ScheduleDAGInstrs.cpp index 34b8ab0b47..5408cdf1ad 100644 --- a/lib/CodeGen/ScheduleDAGInstrs.cpp +++ b/lib/CodeGen/ScheduleDAGInstrs.cpp @@ -677,12 +677,12 @@ MachineBasicBlock *ScheduleDAGInstrs::EmitSchedule() { else // Null SUnit* is a noop. EmitNoop(); - } - // Update the Begin iterator, as the first instruction in the block - // may have been scheduled later. - if (!Sequence.empty()) - Begin = Sequence[0]->getInstr(); + // Update the Begin iterator, as the first instruction in the block + // may have been scheduled later. + if (i == 0) + Begin = prior(InsertPos); + } // Reinsert any remaining debug_values. for (std::vector<std::pair<MachineInstr *, MachineInstr *> >::iterator |