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 | 83059fda621cf9d35b7a5aa553569e0484c2766e (patch) | |
tree | 6117982f99c9e62e5cbe53e3ffef9713a084da7e /lib/CodeGen/LoopAligner.cpp | |
parent | 5a424559e5509e61df7b1d1e124178f8073796dd (diff) | |
download | external_llvm-83059fda621cf9d35b7a5aa553569e0484c2766e.zip external_llvm-83059fda621cf9d35b7a5aa553569e0484c2766e.tar.gz external_llvm-83059fda621cf9d35b7a5aa553569e0484c2766e.tar.bz2 |
Avoid inserting noop's in the middle of a loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60141 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LoopAligner.cpp')
-rw-r--r-- | lib/CodeGen/LoopAligner.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/CodeGen/LoopAligner.cpp b/lib/CodeGen/LoopAligner.cpp index b8d0059..b67f5c3 100644 --- a/lib/CodeGen/LoopAligner.cpp +++ b/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; |