[x86] add test to show missing optimization

This should make it clearer how this proposed patch:
http://reviews.llvm.org/D11393
...will change codegen.

llvm-svn: 262875
This commit is contained in:
Sanjay Patel 2016-03-07 23:13:06 +00:00
parent 55c0dd4b26
commit 8c84f74f3a
1 changed files with 31 additions and 0 deletions

View File

@ -48,3 +48,34 @@ bb2:
ret double %phi
}
; FIXME: With branch weights indicated, bb2 should be placed ahead of bb1.
define double @profile_metadata(double %x, double %y) {
; CHECK-LABEL: profile_metadata:
; CHECK: # BB#0: # %entry
; CHECK-NEXT: mulsd %xmm1, %xmm0
; CHECK-NEXT: xorpd %xmm1, %xmm1
; CHECK-NEXT: ucomisd %xmm1, %xmm0
; CHECK-NEXT: jne .LBB1_1
; CHECK-NEXT: jnp .LBB1_2
; CHECK-NEXT: .LBB1_1: # %bb1
; CHECK-NEXT: addsd {{.*}}(%rip), %xmm0
; CHECK-NEXT: .LBB1_2: # %bb2
; CHECK-NEXT: retq
entry:
%mul = fmul double %x, %y
%cmp = fcmp une double %mul, 0.000000e+00
br i1 %cmp, label %bb1, label %bb2, !prof !1
bb1:
%add = fadd double %mul, -1.000000e+00
br label %bb2
bb2:
%phi = phi double [ %add, %bb1 ], [ %mul, %entry ]
ret double %phi
}
!1 = !{!"branch_weights", i32 1, i32 1000}