xref: /aosp_15_r20/external/llvm/test/tools/gold/X86/opt-level.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llvm-as -o %t.bc %s
2*9880d681SAndroid Build Coastguard Worker; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=save-temps \
3*9880d681SAndroid Build Coastguard Worker; RUN:    -plugin-opt=O0 -r -o %t.o %t.bc
4*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dis < %t.o.opt.bc -o - | FileCheck --check-prefix=CHECK-O0 %s
5*9880d681SAndroid Build Coastguard Worker; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=save-temps \
6*9880d681SAndroid Build Coastguard Worker; RUN:    -plugin-opt=O1 -r -o %t.o %t.bc
7*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dis < %t.o.opt.bc -o - | FileCheck --check-prefix=CHECK-O1 %s
8*9880d681SAndroid Build Coastguard Worker; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=save-temps \
9*9880d681SAndroid Build Coastguard Worker; RUN:    -plugin-opt=O2 -r -o %t.o %t.bc
10*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dis < %t.o.opt.bc -o - | FileCheck --check-prefix=CHECK-O2 %s
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker; CHECK-O0: define internal void @foo(
13*9880d681SAndroid Build Coastguard Worker; CHECK-O1: define internal void @foo(
14*9880d681SAndroid Build Coastguard Worker; CHECK-O2-NOT: define internal void @foo(
15*9880d681SAndroid Build Coastguard Workerdefine internal void @foo() {
16*9880d681SAndroid Build Coastguard Worker  ret void
17*9880d681SAndroid Build Coastguard Worker}
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker; CHECK-O0: define internal i32 @bar(
20*9880d681SAndroid Build Coastguard Worker; CHECK-O1: define internal i32 @bar(
21*9880d681SAndroid Build Coastguard Workerdefine internal i32 @bar(i1 %p) {
22*9880d681SAndroid Build Coastguard Worker  br i1 %p, label %t, label %f
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workert:
25*9880d681SAndroid Build Coastguard Worker  br label %end
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerf:
28*9880d681SAndroid Build Coastguard Worker  br label %end
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Workerend:
31*9880d681SAndroid Build Coastguard Worker  ; CHECK-O0: phi
32*9880d681SAndroid Build Coastguard Worker  ; CHECK-O1: select
33*9880d681SAndroid Build Coastguard Worker  %r = phi i32 [ 1, %t ], [ 2, %f ]
34*9880d681SAndroid Build Coastguard Worker  ret i32 %r
35*9880d681SAndroid Build Coastguard Worker}
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Workerdefine i1 @baz() {
38*9880d681SAndroid Build Coastguard Worker  call void @foo()
39*9880d681SAndroid Build Coastguard Worker  %c = call i32 @bar(i1 true)
40*9880d681SAndroid Build Coastguard Worker  %p = call i1 @llvm.type.test(i8* undef, metadata !"typeid1")
41*9880d681SAndroid Build Coastguard Worker  ret i1 %p
42*9880d681SAndroid Build Coastguard Worker}
43*9880d681SAndroid Build Coastguard Worker
44*9880d681SAndroid Build Coastguard Worker; CHECK-O0-NOT: !type
45*9880d681SAndroid Build Coastguard Worker; CHECK-O1-NOT: !type
46*9880d681SAndroid Build Coastguard Worker; CHECK-O2-NOT: !type
47*9880d681SAndroid Build Coastguard Worker@a = constant i32 1, !type !0
48*9880d681SAndroid Build Coastguard Worker
49*9880d681SAndroid Build Coastguard Worker!0 = !{i32 0, !"typeid1"}
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Workerdeclare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone
52