|
| 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 | +; ModuleID = 'test.c' |
| 84 | +source_filename = "test.c" |
| 85 | +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 86 | +target triple = "x86_64-unknown-linux-gnu" |
| 87 | + |
| 88 | +; Function Attrs: noinline nounwind optnone uwtable |
| 89 | +define dso_local void @foo(i8 signext %a) !type !3 { |
| 90 | +entry: |
| 91 | + ret void |
| 92 | +} |
| 93 | + |
| 94 | +; Function Attrs: noinline nounwind optnone uwtable |
| 95 | +define dso_local i32 @main() !type !4 { |
| 96 | +entry: |
| 97 | + %retval = alloca i32, align 4 |
| 98 | + %fp = alloca void (i8)*, align 8 |
| 99 | + store i32 0, i32* %retval, align 4 |
| 100 | + store void (i8)* @foo, void (i8)** %fp, align 8 |
| 101 | + %0 = load void (i8)*, void (i8)** %fp, align 8 |
| 102 | + call void %0(i8 signext 97) [ "type"(metadata !"_ZTSFvcE.generalized") ] |
| 103 | + ret i32 0 |
| 104 | +} |
| 105 | + |
| 106 | +!llvm.module.flags = !{!0, !1, !2} |
| 107 | + |
| 108 | +!0 = !{i32 1, !"wchar_size", i32 4} |
| 109 | +!1 = !{i32 7, !"uwtable", i32 1} |
| 110 | +!2 = !{i32 7, !"frame-pointer", i32 2} |
| 111 | +!3 = !{i64 0, !"_ZTSFvcE.generalized"} |
| 112 | +!4 = !{i64 0, !"_ZTSFiE.generalized"} |
0 commit comments