[llvm-commits] [llvm] r145677 - /llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp

Hal Finkel hfinkel at anl.gov
Thu Dec 1 20:58:07 PST 2011


Author: hfinkel
Date: Thu Dec  1 22:58:07 2011
New Revision: 145677

URL: http://llvm.org/viewvc/llvm-project?rev=145677&view=rev
Log:
make sure ScheduleDAGInstrs::EmitSchedule does not crash when the first instruction in Sequence is a Noop

Modified:
    llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp

Modified: llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp?rev=145677&r1=145676&r2=145677&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp (original)
+++ llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp Thu Dec  1 22:58:07 2011
@@ -677,12 +677,12 @@
     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





More information about the llvm-commits mailing list