1 ; RUN: opt < %s -passes=inline -inline-threshold=1 -S -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
2 ; RUN: opt < %s -passes='cgscc(inline)' -inline-threshold=1 -S -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
4 define i32 @callee_range(i32 %a, ptr %P) {
5 switch i32 %a, label %sw.default [
7 i32 1000, label %sw.bb1
8 i32 2000, label %sw.bb1
9 i32 3000, label %sw.bb1
10 i32 4000, label %sw.bb1
11 i32 5000, label %sw.bb1
12 i32 6000, label %sw.bb1
13 i32 7000, label %sw.bb1
14 i32 8000, label %sw.bb1
15 i32 9000, label %sw.bb1
19 store volatile i32 %a, ptr %P
22 store volatile i32 %a, ptr %P
25 store volatile i32 %a, ptr %P
31 define i32 @caller_range(i32 %a, ptr %P) {
32 ; CHECK-LABEL: @caller_range(
33 ; CHECK: call i32 @callee_range
34 %r = call i32 @callee_range(i32 %a, ptr %P)
38 define i32 @callee_bittest(i32 %a, ptr %P) {
39 switch i32 %a, label %sw.default [
52 store volatile i32 %a, ptr %P
56 store volatile i32 %a, ptr %P
60 store volatile i32 %a, ptr %P
71 define i32 @caller_bittest(i32 %a, ptr %P) {
72 ; CHECK-LABEL: @caller_bittest(
73 ; CHECK-NOT: call i32 @callee_bittest
74 %r= call i32 @callee_bittest(i32 %a, ptr %P)
78 define i32 @callee_jumptable(i32 %a, ptr %P) {
79 switch i32 %a, label %sw.default [
80 i32 1001, label %sw.bb101
81 i32 1002, label %sw.bb102
82 i32 1003, label %sw.bb103
83 i32 1004, label %sw.bb104
84 i32 1005, label %sw.bb101
85 i32 1006, label %sw.bb102
86 i32 1007, label %sw.bb103
87 i32 1008, label %sw.bb104
88 i32 1009, label %sw.bb101
89 i32 1010, label %sw.bb102
90 i32 1011, label %sw.bb103
91 i32 1012, label %sw.bb104
98 store volatile i32 %a, ptr %P
102 store volatile i32 %a, ptr %P
106 store volatile i32 %a, ptr %P
110 store volatile i32 %a, ptr %P
117 define i32 @caller_jumptable(i32 %a, i32 %b, ptr %P) {
118 ; CHECK-LABEL: @caller_jumptable(
119 ; CHECK: call i32 @callee_jumptable
120 %r = call i32 @callee_jumptable(i32 %b, ptr %P)
125 define internal i32 @callee_negativeCost(i32 %t) {
127 switch i32 %t, label %sw.default [
130 i32 42, label %sw.bb2
131 i32 43, label %sw.bb3
134 sw.bb: ; preds = %entry
137 sw.bb1: ; preds = %entry
140 sw.bb2: ; preds = %entry
143 sw.bb3: ; preds = %entry
146 sw.default: ; preds = %entry
149 cleanup: ; preds = %sw.default, %sw.bb3, %sw.bb2, %sw.bb1, %sw.bb
150 %retval.0 = phi i32 [ 1, %sw.default ], [ 3, %sw.bb3 ], [ 2, %sw.bb2 ], [ 0, %sw.bb1 ], [ 0, %sw.bb ]
154 define i32 @caller_negativeCost(i32 %t) {
155 ; CHECK-LABEL: @caller_negativeCost(
156 ; CHECK-NOT: call i32 @callee_negativeCost
158 %call = call i32 @callee_negativeCost(i32 %t)