summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2011-12-02 04:58:07 +0000
committerHal Finkel <hfinkel@anl.gov>2011-12-02 04:58:07 +0000
commit42018202752617d5095869b599fa847e7f2d2f54 (patch)
tree8d66c01087b4260ac7a157d1350afa4fec913584 /llvm/lib/CodeGen
parent58ca3600817a2f930c9167a423578b6c5189f96b (diff)
downloadbcm5719-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
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/ScheduleDAGInstrs.cpp10
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
OpenPOWER on IntegriCloud