Enable machine sinking critical edge splitting. e.g.
authorEvan Cheng <evan.cheng@apple.com>
Mon, 20 Sep 2010 22:52:00 +0000 (22:52 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Mon, 20 Sep 2010 22:52:00 +0000 (22:52 +0000)
commit44be1a8d661cfab0cc3d11b0dd158271b2d2ca04
treef861658312e3811067f4eb78450f351f8f18e8b6
parente3c65d1ede77c13c4dd0e07c5c908098466a14e0
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114372 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/MachineSink.cpp
test/CodeGen/Mips/2010-07-20-Select.ll
test/CodeGen/X86/compare-inf.ll
test/CodeGen/X86/sink-hoist.ll
test/CodeGen/XCore/ashr.ll