brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · e6b3ddd Raw
86 lines · plain
1; This test fails under the profcheck configuration due to profcheck creating2; metadata.3; UNSUPPORTED: profcheck4 5; RUN: split-file %s %t6 7; RUN: opt -passes=prof-inject %t/inject.ll -S -o - | FileCheck %t/inject.ll8 9; RUN: opt -passes=prof-inject %t/inject-some.ll \10; RUN:   -profcheck-default-select-true-weight=1 -profcheck-default-select-false-weight=6 \11; RUN:   -S -o - | FileCheck %t/inject-some.ll12 13; RUN: opt -passes=prof-verify %t/verify.ll 2>&1 | FileCheck %t/verify.ll14 15; RUN: not opt -passes=prof-verify %t/verify-missing.ll 2>&1 | FileCheck %t/verify-missing.ll16 17; verify we can disable it. It's sufficient to see opt not failing. 18; RUN: opt -passes=prof-verify -profcheck-annotate-select=0 --disable-output %t/verify-missing.ll19 20; verify vector selects without profiles are OK. It's sufficient opt doesn't fail.21; RUN: opt -passes=prof-verify --disable-output %t/verify-vec.ll22 23 24;--- inject.ll25declare void @foo(i32 %a);26define void @bar(i1 %c) {27  %v = select i1 %c, i32 1, i32 228  call void @foo(i32 %v)29  ret void30}31 32define <2 x i32> @vec(<2 x i1> %c, <2 x i32> %v1, <2 x i32> %v2) {33  %r = select <2 x i1> %c, <2 x i32> %v1, <2 x i32> %v234  ret <2 x i32> %r35}36 37; CHECK-LABEL: @bar38; CHECK: %v = select i1 %c, i32 1, i32 2, !prof !139; CHECK-LABEL: @vec40; CHECK-NOT: select {{.*}} !prof41; CHECK: !0 = !{!"function_entry_count", i64 1000}42; CHECK: !1 = !{!"branch_weights", i32 2, i32 3}43 44;--- inject-some.ll45declare void @foo(i32 %a);46define void @bar(i1 %c) {47  %e = select i1 %c, i32 1, i32 2, !prof !048  %c2 = icmp eq i32 %e, 249  %v = select i1 %c2, i32 5, i32 1050  call void @foo(i32 %v)51  ret void52}53!0 = !{!"branch_weights", i32 2, i32 3}54; CHECK-LABEL: @bar55; CHECK: %v = select i1 %c2, i32 5, i32 10, !prof !256; CHECK: !0 = !{!"function_entry_count", i64 1000}57; CHECK: !1 = !{!"branch_weights", i32 2, i32 3}58; CHECK: !2 = !{!"branch_weights", i32 1, i32 6}59 60;--- verify.ll61declare void @foo(i32 %a);62define void @bar(i1 %c) !prof !0 {63  %v = select i1 %c, i32 1, i32 2, !prof !164  call void @foo(i32 %v)65  ret void66}67!0 = !{!"function_entry_count", i64 1000}68!1 = !{!"branch_weights", i32 1, i32 7}69; CHECK-NOT: Profile verification failed: select annotation missing70 71;--- verify-missing.ll72declare void @foo(i32 %a);73define void @bar(i1 %c) !prof !0 {74  %v = select i1 %c, i32 1, i32 275  call void @foo(i32 %v)76  ret void77}78!0 = !{!"function_entry_count", i64 1000}79; CHECK: Profile verification failed: select annotation missing80 81;--- verify-vec.ll82define <2 x i32> @vec(<2 x i1> %c, <2 x i32> %v1, <2 x i32> %v2) !prof !{!"function_entry_count", i32 10} {83  %r = select <2 x i1> %c, <2 x i32> %v1, <2 x i32> %v284  ret <2 x i32> %r85}86