summaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineLICM.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-10-12 02:58:01 +0000
committerBill Wendling <isanbard@gmail.com>2011-10-12 02:58:01 +0000
commita2e87912d826b1843bb5b1058670f09b87aea905 (patch)
treee5244a9e846cdeb3415561d45d83e81f21dac910 /lib/CodeGen/MachineLICM.cpp
parent22e8a366adf5a4c78148928ff64e7e00c1088492 (diff)
downloadllvm-a2e87912d826b1843bb5b1058670f09b87aea905.tar.gz
llvm-a2e87912d826b1843bb5b1058670f09b87aea905.tar.bz2
llvm-a2e87912d826b1843bb5b1058670f09b87aea905.tar.xz
Expand the check for a landing pad so that it looks at the basic block's
containing loop's header to see if that's a landing pad. If it is, then we don't want to hoist instructions out of the loop and above the header. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141767 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineLICM.cpp')
-rw-r--r--lib/CodeGen/MachineLICM.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/CodeGen/MachineLICM.cpp b/lib/CodeGen/MachineLICM.cpp
index 6116281d59..889406a486 100644
--- a/lib/CodeGen/MachineLICM.cpp
+++ b/lib/CodeGen/MachineLICM.cpp
@@ -343,11 +343,6 @@ bool MachineLICM::runOnMachineFunction(MachineFunction &MF) {
continue;
}
- // If the header is a landing pad, then we don't want to hoist instructions
- // out of it. This can happen with SjLj exception handling which has a
- // dispatch table as the landing pad.
- if (CurLoop->getHeader()->isLandingPad()) continue;
-
if (!PreRegAlloc)
HoistRegionPostRA();
else {
@@ -472,6 +467,12 @@ void MachineLICM::HoistRegionPostRA() {
const std::vector<MachineBasicBlock*> Blocks = CurLoop->getBlocks();
for (unsigned i = 0, e = Blocks.size(); i != e; ++i) {
MachineBasicBlock *BB = Blocks[i];
+
+ // If the header of the loop containing this basic block is a landing pad,
+ // then don't try to hoist instructions out of this loop.
+ const MachineLoop *ML = MLI->getLoopFor(BB);
+ if (ML && ML->getHeader()->isLandingPad()) continue;
+
// Conservatively treat live-in's as an external def.
// FIXME: That means a reload that're reused in successor block(s) will not
// be LICM'ed.
@@ -607,6 +608,11 @@ void MachineLICM::HoistRegion(MachineDomTreeNode *N, bool IsHeader) {
assert(N != 0 && "Null dominator tree node?");
MachineBasicBlock *BB = N->getBlock();
+ // If the header of the loop containing this basic block is a landing pad,
+ // then don't try to hoist instructions out of this loop.
+ const MachineLoop *ML = MLI->getLoopFor(BB);
+ if (ML && ML->getHeader()->isLandingPad()) return;
+
// If this subregion is not in the top level loop at all, exit.
if (!CurLoop->contains(BB)) return;