diff options
author | Evan Cheng <evan.cheng@apple.com> | 2010-09-20 22:52:00 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2010-09-20 22:52:00 +0000 |
commit | f3e9a48584f344caa7b211e330387fb39b762265 (patch) | |
tree | ecf3b0aa2e87dde290e0a7a674abeb609acf1f4c /llvm/lib/CodeGen/MachineSink.cpp | |
parent | abb5a7370d021c33c9f4e4640acfe9289b21c93c (diff) | |
download | bcm5719-llvm-f3e9a48584f344caa7b211e330387fb39b762265.tar.gz bcm5719-llvm-f3e9a48584f344caa7b211e330387fb39b762265.zip |
Enable machine sinking critical edge splitting. e.g.
define double @foo(double %x, double %y, i1 %c) nounwind {
%a = fdiv double %x, 3.2
%z = select i1 %c, double %a, double %y
ret double %z
}
Was:
_foo:
divsd LCPI0_0(%rip), %xmm0
testb $1, %dil
jne LBB0_2
movaps %xmm1, %xmm0
LBB0_2:
ret
Now:
_foo:
testb $1, %dil
je LBB0_2
divsd LCPI0_0(%rip), %xmm0
ret
LBB0_2:
movaps %xmm1, %xmm0
ret
This avoids the divsd when early exit is taken.
rdar://8454886
llvm-svn: 114372
Diffstat (limited to 'llvm/lib/CodeGen/MachineSink.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineSink.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp index fda07828530..5969c0b3455 100644 --- a/llvm/lib/CodeGen/MachineSink.cpp +++ b/llvm/lib/CodeGen/MachineSink.cpp @@ -35,10 +35,7 @@ using namespace llvm; static cl::opt<bool> SplitEdges("machine-sink-split", cl::desc("Split critical edges during machine sinking"), - cl::init(false), cl::Hidden); -static cl::opt<unsigned> -SplitLimit("split-limit", - cl::init(~0u), cl::Hidden); + cl::init(true), cl::Hidden); STATISTIC(NumSunk, "Number of machine instructions sunk"); STATISTIC(NumSplit, "Number of critical edges split"); @@ -311,7 +308,7 @@ MachineBasicBlock *MachineSinking::SplitCriticalEdge(MachineInstr *MI, return 0; // Avoid breaking back edge. From == To means backedge for single BB loop. - if (!SplitEdges || NumSplit == SplitLimit || FromBB == ToBB) + if (!SplitEdges || FromBB == ToBB) return 0; // Check for backedges of more "complex" loops. @@ -561,8 +558,6 @@ bool MachineSinking::SinkInstruction(MachineInstr *MI, bool &SawStore) { // BreakPHIEdge is true if all the uses are in the successor MBB being // sunken into and they are all PHI nodes. In this case, machine-sink must // break the critical edge first. - if (NumSplit == SplitLimit) - return false; MachineBasicBlock *NewSucc = SplitCriticalEdge(MI, ParentBlock, SuccToSinkTo, BreakPHIEdge); if (!NewSucc) { |