|
| 1 | +;; Test MIR printer and parser for type id field in call site info. Test that |
| 2 | +;; it works well with/without --emit-call-site-info. |
| 3 | + |
| 4 | +;; Multiplex --call-graph-section and -emit-call-site-info as both utilize |
| 5 | +;; CallSiteInfo and callSites. |
| 6 | + |
| 7 | +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 8 | +;; Test printer and parser with --call-graph-section only. |
| 9 | + |
| 10 | +;; Test printer. |
| 11 | +;; Verify that fwdArgRegs is not set, typeId is set. |
| 12 | +;; Verify the exact typeId value to ensure it is not garbage but the value |
| 13 | +;; computed as the type id from the type operand bundle. |
| 14 | +; RUN: llc --call-graph-section %s -stop-before=finalize-isel -o %t1.mir |
| 15 | +; RUN: cat %t1.mir | FileCheck %s --check-prefix=PRINTER_CGS |
| 16 | +; PRINTER_CGS: name: main |
| 17 | +; PRINTER_CGS: callSites: |
| 18 | +; PRINTER_CGS-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: [], typeId: |
| 19 | +; PRINTER_CGS-NEXT: 7854600665770582568 } |
| 20 | + |
| 21 | + |
| 22 | +;; Test parser. |
| 23 | +;; Verify that we get the same result. |
| 24 | +; RUN: llc --call-graph-section %t1.mir -run-pass=finalize-isel -o - \ |
| 25 | +; RUN: | FileCheck %s --check-prefix=PARSER_CGS |
| 26 | +; PARSER_CGS: name: main |
| 27 | +; PARSER_CGS: callSites: |
| 28 | +; PARSER_CGS-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: [], typeId: |
| 29 | +; PARSER_CGS-NEXT: 7854600665770582568 } |
| 30 | + |
| 31 | +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 32 | +;; Test printer and parser with -emit-call-site-info only. |
| 33 | + |
| 34 | +;; Test printer. |
| 35 | +;; Verify that fwdArgRegs is set, typeId is not set. |
| 36 | +; RUN: llc -emit-call-site-info %s -stop-before=finalize-isel -o %t2.mir |
| 37 | +; RUN: cat %t2.mir | FileCheck %s --check-prefix=PRINTER_CSI |
| 38 | +; PRINTER_CSI: name: main |
| 39 | +; PRINTER_CSI: callSites: |
| 40 | +; PRINTER_CSI-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: |
| 41 | +; PRINTER_CSI-NEXT: { arg: 0, reg: '$edi' } |
| 42 | +; PRINTER_CSI-NOT: typeId: |
| 43 | + |
| 44 | + |
| 45 | +;; Test parser. |
| 46 | +;; Verify that we get the same result. |
| 47 | +; RUN: llc -emit-call-site-info %t2.mir -run-pass=finalize-isel -o - \ |
| 48 | +; RUN: | FileCheck %s --check-prefix=PARSER_CSI |
| 49 | +; PARSER_CSI: name: main |
| 50 | +; PARSER_CSI: callSites: |
| 51 | +; PARSER_CSI-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: |
| 52 | +; PARSER_CSI-NEXT: { arg: 0, reg: '$edi' } |
| 53 | +; PARSER_CSI-NOT: typeId: |
| 54 | + |
| 55 | +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 56 | +;; Test printer and parser with both -emit-call-site-info and --call-graph-section. |
| 57 | + |
| 58 | +;; Test printer. |
| 59 | +;; Verify both fwdArgRegs and typeId are set. |
| 60 | +;; Verify the exact typeId value to ensure it is not garbage but the value |
| 61 | +;; computed as the type id from the type operand bundle. |
| 62 | +; RUN: llc --call-graph-section -emit-call-site-info %s -stop-before=finalize-isel -o %t2.mir |
| 63 | +; RUN: cat %t2.mir | FileCheck %s --check-prefix=PRINTER_CGS_CSI |
| 64 | +; PRINTER_CGS_CSI: name: main |
| 65 | +; PRINTER_CGS_CSI: callSites: |
| 66 | +; PRINTER_CGS_CSI-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: |
| 67 | +; PRINTER_CGS_CSI-NEXT: { arg: 0, reg: '$edi' }, typeId: |
| 68 | +; PRINTER_CGS_CSI-NEXT: 7854600665770582568 } |
| 69 | + |
| 70 | + |
| 71 | +;; Test parser. |
| 72 | +;; Verify that we get the same result. |
| 73 | +; RUN: llc --call-graph-section -emit-call-site-info %t2.mir -run-pass=finalize-isel -o - \ |
| 74 | +; RUN: | FileCheck %s --check-prefix=PARSER_CGS_CSI |
| 75 | +; PARSER_CGS_CSI: name: main |
| 76 | +; PARSER_CGS_CSI: callSites: |
| 77 | +; PARSER_CGS_CSI-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: |
| 78 | +; PARSER_CGS_CSI-NEXT: { arg: 0, reg: '$edi' }, typeId: |
| 79 | +; PARSER_CGS_CSI-NEXT: 7854600665770582568 } |
| 80 | + |
| 81 | +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 82 | + |
| 83 | +; Function Attrs: noinline nounwind optnone uwtable |
| 84 | +define dso_local void @foo(i8 signext %a) !type !3 { |
| 85 | +entry: |
| 86 | + ret void |
| 87 | +} |
| 88 | + |
| 89 | +; Function Attrs: noinline nounwind optnone uwtable |
| 90 | +define dso_local i32 @main() !type !4 { |
| 91 | +entry: |
| 92 | + %retval = alloca i32, align 4 |
| 93 | + %fp = alloca ptr, align 8 |
| 94 | + store i32 0, ptr %retval, align 4 |
| 95 | + store ptr @foo, ptr %fp, align 8 |
| 96 | + %0 = load ptr, ptr %fp, align 8 |
| 97 | + call void %0(i8 signext 97) [ "callee_type"(metadata !"_ZTSFvcE.generalized") ] |
| 98 | + ret i32 0 |
| 99 | +} |
| 100 | + |
| 101 | +!3 = !{i64 0, !"_ZTSFvcE.generalized"} |
| 102 | +!4 = !{i64 0, !"_ZTSFiE.generalized"} |
0 commit comments