[llvm] r262875 - [x86] add test to show missing optimization
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 7 15:13:06 PST 2016
Author: spatel
Date: Mon Mar 7 17:13:06 2016
New Revision: 262875
URL: http://llvm.org/viewvc/llvm-project?rev=262875&view=rev
Log:
[x86] add test to show missing optimization
This should make it clearer how this proposed patch:
http://reviews.llvm.org/D11393
...will change codegen.
Modified:
llvm/trunk/test/CodeGen/X86/fp-une-cmp.ll
Modified: llvm/trunk/test/CodeGen/X86/fp-une-cmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fp-une-cmp.ll?rev=262875&r1=262874&r2=262875&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fp-une-cmp.ll (original)
+++ llvm/trunk/test/CodeGen/X86/fp-une-cmp.ll Mon Mar 7 17:13:06 2016
@@ -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}
+
More information about the llvm-commits
mailing list