1; RUN: llvm-as -o %t.bc %s
2; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=save-temps \
3; RUN:    -plugin-opt=O0 -r -o %t.o %t.bc
4; RUN: llvm-dis < %t.o.opt.bc -o - | FileCheck --check-prefix=CHECK-O0 %s
5; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=save-temps \
6; RUN:    -plugin-opt=O1 -r -o %t.o %t.bc
7; RUN: llvm-dis < %t.o.opt.bc -o - | FileCheck --check-prefix=CHECK-O1 %s
8; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=save-temps \
9; RUN:    -plugin-opt=O2 -r -o %t.o %t.bc
10; RUN: llvm-dis < %t.o.opt.bc -o - | FileCheck --check-prefix=CHECK-O2 %s
11
12; CHECK-O0: define internal void @foo(
13; CHECK-O1: define internal void @foo(
14; CHECK-O2-NOT: define internal void @foo(
15define internal void @foo() {
16  ret void
17}
18
19; CHECK-O0: define internal i32 @bar(
20; CHECK-O1: define internal i32 @bar(
21define internal i32 @bar(i1 %p) {
22  br i1 %p, label %t, label %f
23
24t:
25  br label %end
26
27f:
28  br label %end
29
30end:
31  ; CHECK-O0: phi
32  ; CHECK-O1: select
33  %r = phi i32 [ 1, %t ], [ 2, %f ]
34  ret i32 %r
35}
36
37define void @baz() {
38  call void @foo()
39  %c = call i32 @bar(i1 true)
40  ret void
41}
42
43@a = constant i32 1
44
45!0 = !{!"bitset1", i32* @a, i32 0}
46
47; CHECK-O0-NOT: llvm.bitsets
48; CHECK-O1-NOT: llvm.bitsets
49; CHECK-O2-NOT: llvm.bitsets
50!llvm.bitsets = !{ !0 }
51