brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.4 KiB · 62d5357 Raw
180 lines · plain
1; Test MD_prof validation2 3; RUN: split-file %s %t4 5; RUN: opt -passes=verify %t/valid.ll --disable-output6 7; RUN: not opt -passes=verify %t/wrong-count.ll --disable-output 2>&1 | FileCheck %s --check-prefix=WRONG-COUNT8; RUN: not opt -passes=verify %t/invalid-name1.ll --disable-output 2>&1 | FileCheck %s9; RUN: not opt -passes=verify %t/invalid-name2.ll --disable-output 2>&1 | FileCheck %s10 11; RUN: opt -passes=verify %t/unknown-correct.ll --disable-output12 13; RUN: not opt -passes=verify %t/unknown-invalid.ll --disable-output 2>&1 | FileCheck %s --check-prefix=EXTRA-ARGS14; RUN: not opt -passes=verify %t/unknown-noargs.ll --disable-output 2>&1 | FileCheck %s --check-prefix=NO-ARGS15; RUN: not opt -passes=verify %t/unknown-empty.ll --disable-output 2>&1 | FileCheck %s --check-prefix=EMPTY-ARGS16; RUN: opt -passes=verify %t/unknown-on-function1.ll -S -o - | FileCheck %s --check-prefix=ON-FUNCTION117; RUN: not opt -passes=verify %t/unknown-on-function2.ll --disable-output 2>&1 | FileCheck %s --check-prefix=ON-FUNCTION218; RUN: not opt -passes=verify %t/invalid-unknown-placement.ll --disable-output 2>&1 | FileCheck %s --check-prefix=INVALID-UNKNOWN-PLACEMENT19 20;--- valid.ll21declare void @to_invoke()22declare i32 @__gxx_personality_v0(...)23 24define void @invoker() personality ptr @__gxx_personality_v0 {25  invoke void @to_invoke() to label %exit unwind label %lpad, !prof !026lpad:27  %ll = landingpad {ptr, i32}28  cleanup29  ret void30exit:31  ret void32}33 34define i32 @test(i32 %a) {35  %c = icmp eq i32 %a, 036  br i1 %c, label %yes, label %exit, !prof !037yes:38  switch i32 %a, label %exit [ i32 1, label %case_b39                               i32 2, label %case_c], !prof !140case_b:41  br label %exit42case_c:43  br label %exit44exit:45  %r = select i1 %c, i32 1, i32 2, !prof !046  ret i32 %r47}48!0 = !{!"branch_weights", i32 1, i32 2}49!1 = !{!"branch_weights", i32 1, i32 2, i32 3}50 51;--- wrong-count.ll52define void @test(i32 %a) {53  %c = icmp eq i32 %a, 054  br i1 %c, label %yes, label %no, !prof !055yes:56  ret void57no:58  ret void59}60!0 = !{!"branch_weights", i32 1, i32 2, i32 3}61 62; WRONG-COUNT: Wrong number of operands63 64;--- invalid-name1.ll65define void @test(i1 %0) {66  br i1 %0, label %2, label %3, !prof !0672:68  ret void693:70  ret void71}72!0 = !{!"invalid", i32 1, i32 2}73 74;--- invalid-name2.ll75define void @test(i1 %0) {76  br i1 %0, label %2, label %3, !prof !0772:78  ret void793:80  ret void81}82 83!0 = !{!"function_entry_count", i32 1}84 85; CHECK: expected either branch_weights or VP profile name86 87;--- unknown-correct.ll88declare void @to_invoke()89declare i32 @__gxx_personality_v0(...)90 91define void @invoker() personality ptr @__gxx_personality_v0 {92  invoke void @to_invoke() to label %exit unwind label %lpad, !prof !093lpad:94  %ll = landingpad {ptr, i32}95  cleanup96  ret void97exit:98  ret void99}100 101define i32 @test(i32 %a) {102  %c = icmp eq i32 %a, 0103  br i1 %c, label %yes, label %exit, !prof !0104yes:105  switch i32 %a, label %exit [ i32 1, label %case_b106                               i32 2, label %case_c], !prof !0107case_b:108  br label %exit109case_c:110  br label %exit111exit:112  %r = select i1 %c, i32 1, i32 2, !prof !0113  ret i32 %r114}115 116!0 = !{!"unknown", !"test"}117 118;--- unknown-invalid.ll119define void @test(i32 %a) {120  %c = icmp eq i32 %a, 0121  br i1 %c, label %yes, label %no, !prof !0122yes:123  ret void124no:125  ret void126}127 128!0 = !{!"unknown", i32 12, i32 67}129; EXTRA-ARGS: 'unknown' !prof should have a single additional operand130 131;--- unknown-on-function1.ll132define void @test() !prof !0 {133  ret void134}135 136!0 = !{!"unknown", !"test"}137; ON-FUNCTION1: define void @test() !prof !0138 139;--- unknown-on-function2.ll140define void @test() !prof !0 {141  ret void142}143 144!0 = !{!"unknown", i64 123}145; ON-FUNCTION2: 'unknown' !prof should have an additional operand of type string146 147;--- invalid-unknown-placement.ll148define i32 @test() {149  %r = add i32 1, 2, !prof !0150  ret i32 %r151}152!0 = !{!"unknown", !"test"}153; INVALID-UNKNOWN-PLACEMENT: 'unknown' !prof should only appear on instructions on which 'branch_weights' would154 155;--- unknown-noargs.ll156define void @test(i32 %a) {157  %c = icmp eq i32 %a, 0158  br i1 %c, label %yes, label %no, !prof !0159yes:160  ret void161no:162  ret void163}164 165!0 = !{!"unknown"}166; NO-ARGS: 'unknown' !prof should have a single additional operand167 168;--- unknown-empty.ll169define void @test(i32 %a) {170  %c = icmp eq i32 %a, 0171  br i1 %c, label %yes, label %no, !prof !0172yes:173  ret void174no:175  ret void176}177 178!0 = !{!"unknown", !""}179; EMPTY-ARGS: the 'unknown' !prof operand should not be an empty string180