xref: /aosp_15_r20/external/llvm/test/LTO/X86/diagnostic-handler-remarks.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llvm-as < %s >%t.bc
2*9880d681SAndroid Build Coastguard Worker; PR21108: Diagnostic handlers get pass remarks, even if they're not enabled.
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; Confirm that there are -pass-remarks.
5*9880d681SAndroid Build Coastguard Worker; RUN: llvm-lto -pass-remarks=inline \
6*9880d681SAndroid Build Coastguard Worker; RUN:          -exported-symbol _func2 -pass-remarks-analysis=loop-vectorize \
7*9880d681SAndroid Build Coastguard Worker; RUN:          -exported-symbol _main -o %t.o %t.bc 2>&1 | \
8*9880d681SAndroid Build Coastguard Worker; RUN:     FileCheck %s -allow-empty -check-prefix=REMARKS
9*9880d681SAndroid Build Coastguard Worker; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker; RUN: llvm-lto -pass-remarks=inline -use-diagnostic-handler \
12*9880d681SAndroid Build Coastguard Worker; RUN:          -exported-symbol _func2 -pass-remarks-analysis=loop-vectorize \
13*9880d681SAndroid Build Coastguard Worker; RUN:         -exported-symbol _main -o %t.o %t.bc 2>&1 | \
14*9880d681SAndroid Build Coastguard Worker; RUN:     FileCheck %s -allow-empty -check-prefix=REMARKS_DH
15*9880d681SAndroid Build Coastguard Worker; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker; Confirm that -pass-remarks are not printed by default.
18*9880d681SAndroid Build Coastguard Worker; RUN: llvm-lto \
19*9880d681SAndroid Build Coastguard Worker; RUN:         -exported-symbol _func2 \
20*9880d681SAndroid Build Coastguard Worker; RUN:         -exported-symbol _main -o %t.o %t.bc 2>&1 | \
21*9880d681SAndroid Build Coastguard Worker; RUN:     FileCheck %s -allow-empty
22*9880d681SAndroid Build Coastguard Worker; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Worker; RUN: llvm-lto -use-diagnostic-handler \
25*9880d681SAndroid Build Coastguard Worker; RUN:         -exported-symbol _func2 \
26*9880d681SAndroid Build Coastguard Worker; RUN:         -exported-symbol _main -o %t.o %t.bc 2>&1 | \
27*9880d681SAndroid Build Coastguard Worker; RUN:     FileCheck %s -allow-empty
28*9880d681SAndroid Build Coastguard Worker; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Worker; REMARKS: remark: {{.*}} foo inlined into main
31*9880d681SAndroid Build Coastguard Worker; REMARKS: remark: {{.*}} loop not vectorized: cannot prove it is safe to reorder memory operations
32*9880d681SAndroid Build Coastguard Worker; REMARKS_DH: llvm-lto: remark: {{.*}} foo inlined into main
33*9880d681SAndroid Build Coastguard Worker; REMARKS_DH: llvm-lto: remark: {{.*}} loop not vectorized: cannot prove it is safe to reorder memory operations
34*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: remark:
35*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: llvm-lto:
36*9880d681SAndroid Build Coastguard Worker; NM-NOT: foo
37*9880d681SAndroid Build Coastguard Worker; NM: func2
38*9880d681SAndroid Build Coastguard Worker; NM: main
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-apple-darwin"
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Workerdeclare i32 @bar()
43*9880d681SAndroid Build Coastguard Worker
44*9880d681SAndroid Build Coastguard Workerdefine i32 @foo() {
45*9880d681SAndroid Build Coastguard Worker  %a = call i32 @bar()
46*9880d681SAndroid Build Coastguard Worker  ret i32 %a
47*9880d681SAndroid Build Coastguard Worker}
48*9880d681SAndroid Build Coastguard Worker
49*9880d681SAndroid Build Coastguard Workerdefine i32 @main() {
50*9880d681SAndroid Build Coastguard Worker  %i = call i32 @foo()
51*9880d681SAndroid Build Coastguard Worker  ret i32 %i
52*9880d681SAndroid Build Coastguard Worker}
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Workerdefine i32 @func2(i32* %out, i32* %out2, i32* %A, i32* %B, i32* %C, i32* %D, i32* %E, i32* %F) {
55*9880d681SAndroid Build Coastguard Workerentry:
56*9880d681SAndroid Build Coastguard Worker  br label %for.body
57*9880d681SAndroid Build Coastguard Worker
58*9880d681SAndroid Build Coastguard Workerfor.body:                                         ; preds = %for.body, %entry
59*9880d681SAndroid Build Coastguard Worker  %i.037 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
60*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %i.037
61*9880d681SAndroid Build Coastguard Worker  %0 = load i32, i32* %arrayidx, align 4
62*9880d681SAndroid Build Coastguard Worker  %arrayidx1 = getelementptr inbounds i32, i32* %B, i64 %i.037
63*9880d681SAndroid Build Coastguard Worker  %1 = load i32, i32* %arrayidx1, align 4
64*9880d681SAndroid Build Coastguard Worker  %add = add nsw i32 %1, %0
65*9880d681SAndroid Build Coastguard Worker  %arrayidx2 = getelementptr inbounds i32, i32* %C, i64 %i.037
66*9880d681SAndroid Build Coastguard Worker  %2 = load i32, i32* %arrayidx2, align 4
67*9880d681SAndroid Build Coastguard Worker  %add3 = add nsw i32 %add, %2
68*9880d681SAndroid Build Coastguard Worker  %arrayidx4 = getelementptr inbounds i32, i32* %E, i64 %i.037
69*9880d681SAndroid Build Coastguard Worker  %3 = load i32, i32* %arrayidx4, align 4
70*9880d681SAndroid Build Coastguard Worker  %add5 = add nsw i32 %add3, %3
71*9880d681SAndroid Build Coastguard Worker  %arrayidx6 = getelementptr inbounds i32, i32* %F, i64 %i.037
72*9880d681SAndroid Build Coastguard Worker  %4 = load i32, i32* %arrayidx6, align 4
73*9880d681SAndroid Build Coastguard Worker  %add7 = add nsw i32 %add5, %4
74*9880d681SAndroid Build Coastguard Worker  %arrayidx8 = getelementptr inbounds i32, i32* %out, i64 %i.037
75*9880d681SAndroid Build Coastguard Worker  store i32 %add7, i32* %arrayidx8, align 4
76*9880d681SAndroid Build Coastguard Worker  %5 = load i32, i32* %arrayidx, align 4
77*9880d681SAndroid Build Coastguard Worker  %6 = load i32, i32* %arrayidx1, align 4
78*9880d681SAndroid Build Coastguard Worker  %add11 = add nsw i32 %6, %5
79*9880d681SAndroid Build Coastguard Worker  %7 = load i32, i32* %arrayidx2, align 4
80*9880d681SAndroid Build Coastguard Worker  %add13 = add nsw i32 %add11, %7
81*9880d681SAndroid Build Coastguard Worker  %8 = load i32, i32* %arrayidx4, align 4
82*9880d681SAndroid Build Coastguard Worker  %add15 = add nsw i32 %add13, %8
83*9880d681SAndroid Build Coastguard Worker  %9 = load i32, i32* %arrayidx6, align 4
84*9880d681SAndroid Build Coastguard Worker  %add17 = add nsw i32 %add15, %9
85*9880d681SAndroid Build Coastguard Worker  %arrayidx18 = getelementptr inbounds i32, i32* %out2, i64 %i.037
86*9880d681SAndroid Build Coastguard Worker  store i32 %add17, i32* %arrayidx18, align 4
87*9880d681SAndroid Build Coastguard Worker  %inc = add i64 %i.037, 1
88*9880d681SAndroid Build Coastguard Worker  %exitcond = icmp eq i64 %inc, 256
89*9880d681SAndroid Build Coastguard Worker  br i1 %exitcond, label %for.end, label %for.body
90*9880d681SAndroid Build Coastguard Worker
91*9880d681SAndroid Build Coastguard Workerfor.end:                                          ; preds = %for.body
92*9880d681SAndroid Build Coastguard Worker  ret i32 undef
93*9880d681SAndroid Build Coastguard Worker}
94