Skip to content
  • Evan Cheng's avatar
    Enable machine sinking critical edge splitting. e.g. · f3e9a485
    Evan Cheng authored
    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
    f3e9a485
Loading