• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 i1 @baz() {
38  call void @foo()
39  %c = call i32 @bar(i1 true)
40  %p = call i1 @llvm.type.test(i8* undef, metadata !"typeid1")
41  ret i1 %p
42}
43
44; CHECK-O0-NOT: !type
45; CHECK-O1-NOT: !type
46; CHECK-O2-NOT: !type
47@a = constant i32 1, !type !0
48
49!0 = !{i32 0, !"typeid1"}
50
51declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone
52