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 _main -o %t.o %t.bc 2>&1 | \
7; RUN:     FileCheck %s -allow-empty -check-prefix=REMARKS
8; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
9
10; RUN: llvm-lto -pass-remarks=inline -use-diagnostic-handler \
11; RUN:         -exported-symbol _main -o %t.o %t.bc 2>&1 | \
12; RUN:     FileCheck %s -allow-empty -check-prefix=REMARKS
13; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
14
15; Confirm that -pass-remarks are not printed by default.
16; RUN: llvm-lto \
17; RUN:         -exported-symbol _main -o %t.o %t.bc 2>&1 | \
18; RUN:     FileCheck %s -allow-empty
19; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
20
21; RUN: llvm-lto -use-diagnostic-handler \
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
25
26; REMARKS: remark:
27; CHECK-NOT: remark:
28; NM-NOT: foo
29; NM: main
30
31target triple = "x86_64-apple-darwin"
32
33define i32 @foo() {
34  ret i32 7
35}
36
37define i32 @main() {
38  %i = call i32 @foo()
39  ret i32 %i
40}
41