diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-11-27 01:16:00 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-11-27 01:16:00 +0000 |
commit | 3761143755a4d6f28b3fe944c7d67db8e2d18d09 (patch) | |
tree | 53c39bb31ee489e69274ccfd48348049c1674961 /llvm/lib/CodeGen/LoopAligner.cpp | |
parent | bb9bf88fa4a0d0337f2659d4e442a9f2d0d7159c (diff) | |
download | bcm5719-llvm-3761143755a4d6f28b3fe944c7d67db8e2d18d09.tar.gz bcm5719-llvm-3761143755a4d6f28b3fe944c7d67db8e2d18d09.zip |
Avoid inserting noop's in the middle of a loop.
llvm-svn: 60141
Diffstat (limited to 'llvm/lib/CodeGen/LoopAligner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LoopAligner.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LoopAligner.cpp b/llvm/lib/CodeGen/LoopAligner.cpp index b8d00595d8a..b67f5c3bf91 100644 --- a/llvm/lib/CodeGen/LoopAligner.cpp +++ b/llvm/lib/CodeGen/LoopAligner.cpp @@ -64,8 +64,14 @@ bool LoopAligner::runOnMachineFunction(MachineFunction &MF) { for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) { MachineBasicBlock *MBB = I; - if (MLI->isLoopHeader(MBB)) + if (MLI->isLoopHeader(MBB)) { + MachineBasicBlock *PredBB = prior(I); + if (MLI->getLoopFor(MBB) == MLI->getLoopFor(PredBB)) + // If previously BB is in the same loop, don't align this BB. We want + // to prevent adding noop's inside a loop. + continue; MBB->setAlignment(Align); + } } return true; |