xref: /llvm-project/llvm/test/LTO/Resolution/X86/diagnostic-handler-remarks.ll (revision e0d069598bc8c147c8b6625253c1f32f26baaab1)
1; Test of LTO with opt remarks YAML output.
2
3; First try with Regular LTO
4; RUN: llvm-as < %s >%t.bc
5; RUN: rm -f %t.yaml
6; RUN: llvm-lto2 run -pass-remarks-output=%t.yaml \
7; RUN:           -pass-remarks-filter=inline \
8; RUN:           -r %t.bc,tinkywinky,p \
9; RUN:           -r %t.bc,patatino,px \
10; RUN:           -r %t.bc,main,px -o %t.o %t.bc
11; RUN: cat %t.yaml | FileCheck %s -check-prefixes=YAML,YAML-NO-ANNOTATE
12
13; Try again with ThinLTO
14; RUN: opt -module-summary %s -o %t.bc
15; RUN: rm -f %t.thin.1.yaml
16; RUN: llvm-lto2 run -pass-remarks-output=%t \
17; RUN:           -pass-remarks-filter=inline \
18; RUN:           -r %t.bc,tinkywinky,p \
19; RUN:           -r %t.bc,patatino,px \
20; RUN:           -r %t.bc,main,px -o %t.o %t.bc
21; RUN: cat %t.thin.1.yaml | FileCheck %s -check-prefixes=YAML,YAML-NO-ANNOTATE
22
23; Check that remarks are annotated with LTO phase information with `-annotate-inline-phase`.
24; First try with Regular LTO
25; RUN: llvm-as < %s >%t.bc
26; RUN: rm -f %t.yaml
27; RUN: llvm-lto2 run -pass-remarks-output=%t.yaml \
28; RUN:           -pass-remarks-filter=inline \
29; RUN:           -annotate-inline-phase \
30; RUN:           -r %t.bc,tinkywinky,p \
31; RUN:           -r %t.bc,patatino,px \
32; RUN:           -r %t.bc,main,px -o %t.o %t.bc
33; RUN: cat %t.yaml | FileCheck %s -check-prefixes=YAML,YAML-POSTLINK-LTO
34
35; Try again with ThinLTO
36; RUN: opt -module-summary %s -o %t.bc
37; RUN: rm -f %t.thin.1.yaml
38; RUN: llvm-lto2 run -pass-remarks-output=%t \
39; RUN:           -pass-remarks-filter=inline \
40; RUN:           -annotate-inline-phase \
41; RUN:           -r %t.bc,tinkywinky,p \
42; RUN:           -r %t.bc,patatino,px \
43; RUN:           -r %t.bc,main,px -o %t.o %t.bc
44; RUN: cat %t.thin.1.yaml | FileCheck %s -check-prefixes=YAML,YAML-POSTLINK-LTO
45
46; YAML:      --- !Passed
47; YAML-NO-ANNOTATE: Pass:         inline
48; YAML-POSTLINK-LTO-NEXT: Pass:            postlink-cgscc-inline
49; YAML-NEXT: Name:            Inlined
50; YAML-NEXT: Function:        main
51; YAML-NEXT: Args:
52; YAML-NEXT:   - String:          ''''
53; YAML-NEXT:   - Callee:          tinkywinky
54; YAML-NEXT:   - String:          ''' inlined into '''
55; YAML-NEXT:   - Caller:          main
56; YAML-NEXT:   - String:          ''''
57; YAML-NEXT:   - String:          ' with '
58; YAML-NEXT:   - String:          '(cost='
59; YAML-NEXT:   - Cost:            '-15000'
60; YAML-NEXT:   - String:          ', threshold='
61; YAML-NEXT:   - Threshold:       '337'
62; YAML-NEXT:   - String:          ')'
63; YAML-NEXT: ...
64
65target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
66target triple = "x86_64-scei-ps4"
67
68declare i32 @patatino()
69
70define i32 @tinkywinky() {
71  %a = call i32 @patatino()
72  ret i32 %a
73}
74
75define i32 @main() {
76  %i = call i32 @tinkywinky()
77  ret i32 %i
78}
79