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 | 42018202752617d5095869b599fa847e7f2d2f54 (patch) | |
| tree | 8d66c01087b4260ac7a157d1350afa4fec913584 | |
| parent | 58ca3600817a2f930c9167a423578b6c5189f96b (diff) | |
| download | bcm5719-llvm-42018202752617d5095869b599fa847e7f2d2f54.tar.gz bcm5719-llvm-42018202752617d5095869b599fa847e7f2d2f54.zip | |
make sure ScheduleDAGInstrs::EmitSchedule does not crash when the first instruction in Sequence is a Noop
llvm-svn: 145677
| -rw-r--r-- | llvm/lib/CodeGen/ScheduleDAGInstrs.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp b/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp index 34b8ab0b47f..5408cdf1ad5 100644 --- a/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp +++ b/llvm/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 |

