diff options
author | Andrew Trick <atrick@apple.com> | 2012-03-09 08:02:51 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2012-03-09 08:02:51 +0000 |
commit | 1fabd9f85e8ac728c35cb63c70d8aac2c94c92a8 (patch) | |
tree | fbfe39e7710c12660d80dd32f340dbbe4ab79472 /lib/CodeGen/MachineScheduler.cpp | |
parent | 72051bf629087bb7d7e68aa4d553be8137098056 (diff) | |
download | external_llvm-1fabd9f85e8ac728c35cb63c70d8aac2c94c92a8.tar.gz external_llvm-1fabd9f85e8ac728c35cb63c70d8aac2c94c92a8.tar.bz2 external_llvm-1fabd9f85e8ac728c35cb63c70d8aac2c94c92a8.zip |
misched: handle scheduling region boundaries nicely.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152393 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineScheduler.cpp')
-rw-r--r-- | lib/CodeGen/MachineScheduler.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/CodeGen/MachineScheduler.cpp b/lib/CodeGen/MachineScheduler.cpp index 4f27274796..5c44a0e24d 100644 --- a/lib/CodeGen/MachineScheduler.cpp +++ b/lib/CodeGen/MachineScheduler.cpp @@ -141,12 +141,21 @@ bool MachineScheduler::runOnMachineFunction(MachineFunction &mf) { for (MachineFunction::iterator MBB = MF->begin(), MBBEnd = MF->end(); MBB != MBBEnd; ++MBB) { + Scheduler->startBlock(MBB); + // 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();) { - Scheduler->startBlock(MBB); + // Avoid decrementing RegionEnd for blocks with no terminator. + if (RegionEnd != MBB->end() + || TII->isSchedulingBoundary(llvm::prior(RegionEnd), MBB, *MF)) { + --RegionEnd; + // Count the boundary instruction. + --RemainingCount; + } + // The next region starts above the previous region. Look backward in the // instruction stream until we find the nearest boundary. MachineBasicBlock::iterator I = RegionEnd; @@ -160,11 +169,9 @@ bool MachineScheduler::runOnMachineFunction(MachineFunction &mf) { // Skip empty scheduling regions (0 or 1 schedulable instructions). if (I == RegionEnd || I == llvm::prior(RegionEnd)) { - RegionEnd = llvm::prior(RegionEnd); - if (I != RegionEnd) - --RemainingCount; // Close the current region. Bundle the terminator if needed. Scheduler->exitRegion(); + RegionEnd = I; continue; } DEBUG(dbgs() << "MachineScheduling " << MF->getFunction()->getName() |