1 ; RUN: llvm-as < %s >%t.bc
2 ; PR21108: Diagnostic handlers get pass remarks, even if they're not enabled.
4 ; FIXME: Update checks for new pass manager.
6 ; Confirm that there are -pass-remarks.
7 ; RUN: llvm-lto -use-new-pm=false \
8 ; RUN: -pass-remarks=inline \
9 ; RUN: -exported-symbol _func2 -pass-remarks-analysis=loop-vectorize \
10 ; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
11 ; RUN: FileCheck %s -allow-empty -check-prefix=REMARKS
12 ; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
14 ; RUN: llvm-lto -use-new-pm=false \
15 ; RUN: -pass-remarks=inline -use-diagnostic-handler \
16 ; RUN: -exported-symbol _func2 -pass-remarks-analysis=loop-vectorize \
17 ; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
18 ; RUN: FileCheck %s -allow-empty -check-prefix=REMARKS_DH
19 ; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
21 ; Confirm that -pass-remarks are not printed by default.
22 ; RUN: llvm-lto -use-new-pm=false \
23 ; RUN: -exported-symbol _func2 \
24 ; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
25 ; RUN: FileCheck %s -allow-empty
26 ; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
28 ; RUN: llvm-lto -use-new-pm=false \
29 ; RUN: -use-diagnostic-handler \
30 ; RUN: -exported-symbol _func2 \
31 ; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
32 ; RUN: FileCheck %s -allow-empty
33 ; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
35 ; Optimization records are collected regardless of the diagnostic handler
37 ; RUN: llvm-lto -use-new-pm=false \
38 ; RUN: -lto-pass-remarks-output=%t.yaml \
39 ; RUN: -exported-symbol _func2 \
40 ; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
41 ; RUN: FileCheck %s -allow-empty
42 ; RUN: cat %t.yaml | FileCheck %s -check-prefix=YAML
44 ; REMARKS: remark: {{.*}} 'foo' inlined into 'main'
45 ; REMARKS: remark: {{.*}} loop not vectorized: cannot prove it is safe to reorder memory operations
46 ; REMARKS_DH: llvm-lto: remark: {{.*}} 'foo' inlined into 'main'
47 ; REMARKS_DH: llvm-lto: remark: {{.*}} loop not vectorized: cannot prove it is safe to reorder memory operations
49 ; CHECK-NOT: llvm-lto:
55 ; YAML-NEXT: Pass: inline
56 ; YAML-NEXT: Name: Inlined
57 ; YAML-NEXT: Function: main
59 ; YAML-NEXT: - String: ''''
60 ; YAML-NEXT: - Callee: foo
61 ; YAML-NEXT: - String: ''' inlined into '''
62 ; YAML-NEXT: - Caller: main
63 ; YAML-NEXT: - String: ''''
64 ; YAML-NEXT: - String: ' with '
65 ; YAML-NEXT: - String: '(cost='
66 ; YAML-NEXT: - Cost: '-15000'
67 ; YAML-NEXT: - String: ', threshold='
68 ; YAML-NEXT: - Threshold: '337'
69 ; YAML-NEXT: - String: ')'
72 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
73 target triple = "x86_64-apple-darwin"
87 define i32 @func2(i32* %out, i32* %out2, i32* %A, i32* %B, i32* %C, i32* %D, i32* %E, i32* %F) {
91 for.body: ; preds = %for.body, %entry
92 %i.037 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
93 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.037
94 %0 = load i32, i32* %arrayidx, align 4
95 %arrayidx1 = getelementptr inbounds i32, i32* %B, i64 %i.037
96 %1 = load i32, i32* %arrayidx1, align 4
97 %add = add nsw i32 %1, %0
98 %arrayidx2 = getelementptr inbounds i32, i32* %C, i64 %i.037
99 %2 = load i32, i32* %arrayidx2, align 4
100 %add3 = add nsw i32 %add, %2
101 %arrayidx4 = getelementptr inbounds i32, i32* %E, i64 %i.037
102 %3 = load i32, i32* %arrayidx4, align 4
103 %add5 = add nsw i32 %add3, %3
104 %arrayidx6 = getelementptr inbounds i32, i32* %F, i64 %i.037
105 %4 = load i32, i32* %arrayidx6, align 4
106 %add7 = add nsw i32 %add5, %4
107 %arrayidx8 = getelementptr inbounds i32, i32* %out, i64 %i.037
108 store i32 %add7, i32* %arrayidx8, align 4
109 %5 = load i32, i32* %arrayidx, align 4
110 %6 = load i32, i32* %arrayidx1, align 4
111 %add11 = add nsw i32 %6, %5
112 %7 = load i32, i32* %arrayidx2, align 4
113 %add13 = add nsw i32 %add11, %7
114 %8 = load i32, i32* %arrayidx4, align 4
115 %add15 = add nsw i32 %add13, %8
116 %9 = load i32, i32* %arrayidx6, align 4
117 %add17 = add nsw i32 %add15, %9
118 %arrayidx18 = getelementptr inbounds i32, i32* %out2, i64 %i.037
119 store i32 %add17, i32* %arrayidx18, align 4
120 %inc = add i64 %i.037, 1
121 %exitcond = icmp eq i64 %inc, 256
122 br i1 %exitcond, label %for.end, label %for.body
124 for.end: ; preds = %for.body