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.
5 ; RUN: llvm-lto -pass-remarks=inline \
6 ; RUN: -exported-symbol _func2 -pass-remarks-analysis=loop-vectorize \
7 ; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
8 ; RUN: FileCheck %s -allow-empty -check-prefix=REMARKS
9 ; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
11 ; RUN: llvm-lto -pass-remarks=inline -use-diagnostic-handler \
12 ; RUN: -exported-symbol _func2 -pass-remarks-analysis=loop-vectorize \
13 ; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
14 ; RUN: FileCheck %s -allow-empty -check-prefix=REMARKS_DH
15 ; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
17 ; Confirm that -pass-remarks are not printed by default.
19 ; RUN: -exported-symbol _func2 \
20 ; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
21 ; RUN: FileCheck %s -allow-empty
22 ; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
24 ; RUN: llvm-lto -use-diagnostic-handler \
25 ; RUN: -exported-symbol _func2 \
26 ; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
27 ; RUN: FileCheck %s -allow-empty
28 ; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
30 ; Optimization records are collected regardless of the diagnostic handler
32 ; RUN: llvm-lto -lto-pass-remarks-output=%t.yaml \
33 ; RUN: -exported-symbol _func2 \
34 ; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
35 ; RUN: FileCheck %s -allow-empty
36 ; RUN: cat %t.yaml | FileCheck %s -check-prefix=YAML
38 ; REMARKS: remark: {{.*}} foo inlined into main
39 ; REMARKS: remark: {{.*}} loop not vectorized: cannot prove it is safe to reorder memory operations
40 ; REMARKS_DH: llvm-lto: remark: {{.*}} foo inlined into main
41 ; REMARKS_DH: llvm-lto: remark: {{.*}} loop not vectorized: cannot prove it is safe to reorder memory operations
43 ; CHECK-NOT: llvm-lto:
49 ; YAML-NEXT: Pass: inline
50 ; YAML-NEXT: Name: Inlined
51 ; YAML-NEXT: Function: main
53 ; YAML-NEXT: - Callee: foo
54 ; YAML-NEXT: - String: ' inlined into '
55 ; YAML-NEXT: - Caller: main
56 ; YAML-NEXT: - String: ' with '
57 ; YAML-NEXT: - String: '(cost='
58 ; YAML-NEXT: - Cost: '-15000'
59 ; YAML-NEXT: - String: ', threshold='
60 ; YAML-NEXT: - Threshold: '337'
61 ; YAML-NEXT: - String: ')'
64 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
65 target triple = "x86_64-apple-darwin"
79 define i32 @func2(i32* %out, i32* %out2, i32* %A, i32* %B, i32* %C, i32* %D, i32* %E, i32* %F) {
83 for.body: ; preds = %for.body, %entry
84 %i.037 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
85 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.037
86 %0 = load i32, i32* %arrayidx, align 4
87 %arrayidx1 = getelementptr inbounds i32, i32* %B, i64 %i.037
88 %1 = load i32, i32* %arrayidx1, align 4
89 %add = add nsw i32 %1, %0
90 %arrayidx2 = getelementptr inbounds i32, i32* %C, i64 %i.037
91 %2 = load i32, i32* %arrayidx2, align 4
92 %add3 = add nsw i32 %add, %2
93 %arrayidx4 = getelementptr inbounds i32, i32* %E, i64 %i.037
94 %3 = load i32, i32* %arrayidx4, align 4
95 %add5 = add nsw i32 %add3, %3
96 %arrayidx6 = getelementptr inbounds i32, i32* %F, i64 %i.037
97 %4 = load i32, i32* %arrayidx6, align 4
98 %add7 = add nsw i32 %add5, %4
99 %arrayidx8 = getelementptr inbounds i32, i32* %out, i64 %i.037
100 store i32 %add7, i32* %arrayidx8, align 4
101 %5 = load i32, i32* %arrayidx, align 4
102 %6 = load i32, i32* %arrayidx1, align 4
103 %add11 = add nsw i32 %6, %5
104 %7 = load i32, i32* %arrayidx2, align 4
105 %add13 = add nsw i32 %add11, %7
106 %8 = load i32, i32* %arrayidx4, align 4
107 %add15 = add nsw i32 %add13, %8
108 %9 = load i32, i32* %arrayidx6, align 4
109 %add17 = add nsw i32 %add15, %9
110 %arrayidx18 = getelementptr inbounds i32, i32* %out2, i64 %i.037
111 store i32 %add17, i32* %arrayidx18, align 4
112 %inc = add i64 %i.037, 1
113 %exitcond = icmp eq i64 %inc, 256
114 br i1 %exitcond, label %for.end, label %for.body
116 for.end: ; preds = %for.body