• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llvm-as < %s >%t.bc
2; PR21108: Diagnostic handlers get pass remarks, even if they're not enabled.
3
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
10
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
16
17; Confirm that -pass-remarks are not printed by default.
18; RUN: llvm-lto \
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
23
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
29
30; Optimization records are collected regardless of the diagnostic handler
31; RUN: rm -f %t.yaml
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
37
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
42; CHECK-NOT: remark:
43; CHECK-NOT: llvm-lto:
44; NM-NOT: foo
45; NM: func2
46; NM: main
47
48; YAML:      --- !Passed
49; YAML-NEXT: Pass:            inline
50; YAML-NEXT: Name:            Inlined
51; YAML-NEXT: Function:        main
52; YAML-NEXT: Args:
53; YAML-NEXT:   - Callee:          foo
54; YAML-NEXT:   - String:          ' inlined into '
55; YAML-NEXT:   - Caller:          main
56; YAML-NEXT:   - String:          ' with cost='
57; YAML-NEXT:   - Cost:            '-15000'
58; YAML-NEXT:   - String:          ' (threshold='
59; YAML-NEXT:   - Threshold:       '337'
60; YAML-NEXT:   - String:          ')'
61; YAML-NEXT: ...
62
63target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
64target triple = "x86_64-apple-darwin"
65
66declare i32 @bar()
67
68define i32 @foo() {
69  %a = call i32 @bar()
70  ret i32 %a
71}
72
73define i32 @main() {
74  %i = call i32 @foo()
75  ret i32 %i
76}
77
78define i32 @func2(i32* %out, i32* %out2, i32* %A, i32* %B, i32* %C, i32* %D, i32* %E, i32* %F) {
79entry:
80  br label %for.body
81
82for.body:                                         ; preds = %for.body, %entry
83  %i.037 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
84  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.037
85  %0 = load i32, i32* %arrayidx, align 4
86  %arrayidx1 = getelementptr inbounds i32, i32* %B, i64 %i.037
87  %1 = load i32, i32* %arrayidx1, align 4
88  %add = add nsw i32 %1, %0
89  %arrayidx2 = getelementptr inbounds i32, i32* %C, i64 %i.037
90  %2 = load i32, i32* %arrayidx2, align 4
91  %add3 = add nsw i32 %add, %2
92  %arrayidx4 = getelementptr inbounds i32, i32* %E, i64 %i.037
93  %3 = load i32, i32* %arrayidx4, align 4
94  %add5 = add nsw i32 %add3, %3
95  %arrayidx6 = getelementptr inbounds i32, i32* %F, i64 %i.037
96  %4 = load i32, i32* %arrayidx6, align 4
97  %add7 = add nsw i32 %add5, %4
98  %arrayidx8 = getelementptr inbounds i32, i32* %out, i64 %i.037
99  store i32 %add7, i32* %arrayidx8, align 4
100  %5 = load i32, i32* %arrayidx, align 4
101  %6 = load i32, i32* %arrayidx1, align 4
102  %add11 = add nsw i32 %6, %5
103  %7 = load i32, i32* %arrayidx2, align 4
104  %add13 = add nsw i32 %add11, %7
105  %8 = load i32, i32* %arrayidx4, align 4
106  %add15 = add nsw i32 %add13, %8
107  %9 = load i32, i32* %arrayidx6, align 4
108  %add17 = add nsw i32 %add15, %9
109  %arrayidx18 = getelementptr inbounds i32, i32* %out2, i64 %i.037
110  store i32 %add17, i32* %arrayidx18, align 4
111  %inc = add i64 %i.037, 1
112  %exitcond = icmp eq i64 %inc, 256
113  br i1 %exitcond, label %for.end, label %for.body
114
115for.end:                                          ; preds = %for.body
116  ret i32 undef
117}
118