[llvm-commits] [llvm] r152356 - /llvm/trunk/lib/CodeGen/MachineScheduler.cpp

Evan Cheng evan.cheng at apple.com
Thu Mar 8 16:24:29 PST 2012


Author: evancheng
Date: Thu Mar  8 18:24:29 2012
New Revision: 152356

URL: http://llvm.org/viewvc/llvm-project?rev=152356&view=rev
Log:
Cache MBB->begin. It's possible the scheduler / bundler may change MBB->begin().

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

Modified: llvm/trunk/lib/CodeGen/MachineScheduler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineScheduler.cpp?rev=152356&r1=152355&r2=152356&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineScheduler.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineScheduler.cpp Thu Mar  8 18:24:29 2012
@@ -128,13 +128,13 @@
     // Break the block into scheduling regions [I, RegionEnd), and schedule each
     // region as soon as it is discovered.
     unsigned RemainingCount = MBB->size();
-    for(MachineBasicBlock::iterator RegionEnd = MBB->end();
-        RegionEnd != MBB->begin();) {
+    for(MachineBasicBlock::iterator RegionEnd = MBB->end(),
+          RegionStart = MBB->begin(); RegionEnd != RegionStart;) {
       Scheduler->startBlock(MBB);
       // The next region starts above the previous region. Look backward in the
       // instruction stream until we find the nearest boundary.
       MachineBasicBlock::iterator I = RegionEnd;
-      for(;I != MBB->begin(); --I, --RemainingCount) {
+      for(;I != RegionStart; --I, --RemainingCount) {
         if (TII->isSchedulingBoundary(llvm::prior(I), MBB, *MF))
           break;
       }





More information about the llvm-commits mailing list