From: Sanjay Patel Date: Mon, 7 Mar 2016 23:13:06 +0000 (+0000) Subject: [x86] add test to show missing optimization X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8c84f74f3ae3664f95a2e695587ab802c49b524a;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/llvm/test/CodeGen/X86/fp-une-cmp.ll b/llvm/test/CodeGen/X86/fp-une-cmp.ll index e0b8f61..9fab5c4 100644 --- a/llvm/test/CodeGen/X86/fp-une-cmp.ll +++ b/llvm/test/CodeGen/X86/fp-une-cmp.ll @@ -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} +