diff options
author | Dan Gohman <gohman@apple.com> | 2010-04-05 19:17:22 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-04-05 19:17:22 +0000 |
commit | c4ae94dee8c9a07334de7ffd85c45893208cca77 (patch) | |
tree | 735529519bec82748cb7af825994ff34a239f275 /lib/CodeGen/MachineSink.cpp | |
parent | 54ab2e9326993d9db0e393d3285a5c0a72af2c51 (diff) |
Don't do code sinking on unreachable blocks. It's unprofitable and hazardous.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100455 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineSink.cpp')
-rw-r--r-- | lib/CodeGen/MachineSink.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineSink.cpp b/lib/CodeGen/MachineSink.cpp index e47ba7c2cc..e659619015 100644 --- a/lib/CodeGen/MachineSink.cpp +++ b/lib/CodeGen/MachineSink.cpp @@ -126,6 +126,11 @@ bool MachineSinking::ProcessBlock(MachineBasicBlock &MBB) { // Can't sink anything out of a block that has less than two successors. if (MBB.succ_size() <= 1 || MBB.empty()) return false; + // Don't bother sinking code out of unreachable blocks. In addition to being + // unprofitable, it can also lead to infinite looping, because in an unreachable + // loop there may be nowhere to stop. + if (!DT->isReachableFromEntry(&MBB)) return false; + bool MadeChange = false; // Walk the basic block bottom-up. Remember if we saw a store. |