1 ; RUN: llvm-as < %s >%t.bc
2 ; PR21108: Diagnostic handlers get pass remarks, even if they're not enabled.
4 ; Confirm that there are -pass-remarks.
6 ; RUN: -pass-remarks=inline \
7 ; RUN: -exported-symbol _func2 -pass-remarks-analysis=loop-vectorize \
8 ; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
9 ; RUN: FileCheck %s -allow-empty -check-prefix=REMARKS
10 ; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
13 ; RUN: -pass-remarks=inline -use-diagnostic-handler \
14 ; RUN: -exported-symbol _func2 -pass-remarks-analysis=loop-vectorize \
15 ; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
16 ; RUN: FileCheck %s -allow-empty -check-prefix=REMARKS_DH
17 ; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
19 ; Confirm that -pass-remarks are not printed by default.
21 ; RUN: -exported-symbol _func2 \
22 ; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
23 ; RUN: FileCheck %s -allow-empty
24 ; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
27 ; RUN: -use-diagnostic-handler \
28 ; RUN: -exported-symbol _func2 \
29 ; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
30 ; RUN: FileCheck %s -allow-empty
31 ; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
33 ; Optimization records are collected regardless of the diagnostic handler
36 ; RUN: -lto-pass-remarks-output=%t.yaml \
37 ; RUN: -exported-symbol _func2 \
38 ; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
39 ; RUN: FileCheck %s -allow-empty
40 ; RUN: cat %t.yaml | FileCheck %s -check-prefixes=YAML,YAML-NO-ANNOTATE
42 ; Try again with `-annotate-inline-lto-phase`.
45 ; RUN: -annotate-inline-phase \
46 ; RUN: -lto-pass-remarks-output=%t.yaml \
47 ; RUN: -exported-symbol _func2 \
48 ; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
49 ; RUN: FileCheck %s -allow-empty
50 ; RUN: cat %t.yaml | FileCheck %s -check-prefixes=YAML,YAML-ANNOTATE
52 ; REMARKS: remark: {{.*}} 'foo' inlined into 'main'
53 ; REMARKS: remark: {{.*}} the cost-model indicates that interleaving is not beneficial
54 ; REMARKS_DH: llvm-lto: remark: {{.*}} 'foo' inlined into 'main'
55 ; REMARKS_DH: llvm-lto: remark: {{.*}} the cost-model indicates that interleaving is not beneficial
57 ; CHECK-NOT: llvm-lto:
63 ; YAML-NO-ANNOTATE-NEXT: Pass: inline
64 ; YAML-ANNOTATE-NEXT: Pass: postlink-cgscc-inline
65 ; YAML-NEXT: Name: Inlined
66 ; YAML-NEXT: Function: main
68 ; YAML-NEXT: - String: ''''
69 ; YAML-NEXT: - Callee: foo
70 ; YAML-NEXT: - String: ''' inlined into '''
71 ; YAML-NEXT: - Caller: main
72 ; YAML-NEXT: - String: ''''
73 ; YAML-NEXT: - String: ' with '
74 ; YAML-NEXT: - String: '(cost='
75 ; YAML-NEXT: - Cost: '-15000'
76 ; YAML-NEXT: - String: ', threshold='
77 ; YAML-NEXT: - Threshold: '337'
78 ; YAML-NEXT: - String: ')'
81 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
82 target triple = "x86_64-apple-darwin"
96 define i32 @func2(ptr %out, ptr %out2, ptr %A, ptr %B, ptr %C, ptr %D, ptr %E, ptr %F) {
100 for.body: ; preds = %for.body, %entry
101 %i.037 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
102 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %i.037
103 %0 = load i32, ptr %arrayidx, align 4
104 %arrayidx1 = getelementptr inbounds i32, ptr %B, i64 %i.037
105 %1 = load i32, ptr %arrayidx1, align 4
106 %add = add nsw i32 %1, %0
107 %arrayidx2 = getelementptr inbounds i32, ptr %C, i64 %i.037
108 %2 = load i32, ptr %arrayidx2, align 4
109 %add3 = add nsw i32 %add, %2
110 %arrayidx4 = getelementptr inbounds i32, ptr %E, i64 %i.037
111 %3 = load i32, ptr %arrayidx4, align 4
112 %add5 = add nsw i32 %add3, %3
113 %arrayidx6 = getelementptr inbounds i32, ptr %F, i64 %i.037
114 %4 = load i32, ptr %arrayidx6, align 4
115 %add7 = add nsw i32 %add5, %4
116 %arrayidx8 = getelementptr inbounds i32, ptr %out, i64 %i.037
117 store i32 %add7, ptr %arrayidx8, align 4
118 %5 = load i32, ptr %arrayidx, align 4
119 %6 = load i32, ptr %arrayidx1, align 4
120 %add11 = add nsw i32 %6, %5
121 %7 = load i32, ptr %arrayidx2, align 4
122 %add13 = add nsw i32 %add11, %7
123 %8 = load i32, ptr %arrayidx4, align 4
124 %add15 = add nsw i32 %add13, %8
125 %9 = load i32, ptr %arrayidx6, align 4
126 %add17 = add nsw i32 %add15, %9
127 %arrayidx18 = getelementptr inbounds i32, ptr %out2, i64 %i.037
128 store i32 %add17, ptr %arrayidx18, align 4
129 %inc = add i64 %i.037, 1
130 %exitcond = icmp eq i64 %inc, 256
131 br i1 %exitcond, label %for.end, label %for.body
133 for.end: ; preds = %for.body