1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt %s -S -passes=inline -inline-threshold=11 | FileCheck %s
4 ; Check for scenarios without TTI.
6 define i64 @foo1(i64 %a) {
7 ; CHECK-LABEL: define i64 @foo1(
8 ; CHECK-SAME: i64 [[A:%.*]]) {
9 ; CHECK-NEXT: [[B:%.*]] = call i64 @bar1(i64 [[A]])
10 ; CHECK-NEXT: ret i64 [[B]]
12 %b = call i64 @bar1(i64 %a)
16 define i64 @foo2(i64 %a) {
17 ; CHECK-LABEL: define i64 @foo2(
18 ; CHECK-SAME: i64 [[A:%.*]]) {
19 ; CHECK-NEXT: [[B_I:%.*]] = call i64 @bar2(i64 [[A]])
20 ; CHECK-NEXT: ret i64 [[B_I]]
22 %b = call i64 @bar2(i64 %a)
26 define i64 @bar1(i64 %a) {
27 ; CHECK-LABEL: define i64 @bar1(
28 ; CHECK-SAME: i64 [[A:%.*]]) {
29 ; CHECK-NEXT: switch i64 [[A]], label [[DEFAULT_BRANCH:%.*]] [
30 ; CHECK-NEXT: i64 0, label [[BRANCH_0:%.*]]
31 ; CHECK-NEXT: i64 2, label [[BRANCH_2:%.*]]
32 ; CHECK-NEXT: i64 4, label [[BRANCH_4:%.*]]
33 ; CHECK-NEXT: i64 6, label [[BRANCH_6:%.*]]
36 ; CHECK-NEXT: br label [[EXIT:%.*]]
38 ; CHECK-NEXT: br label [[EXIT]]
40 ; CHECK-NEXT: br label [[EXIT]]
42 ; CHECK-NEXT: br label [[EXIT]]
43 ; CHECK: default_branch:
44 ; CHECK-NEXT: br label [[EXIT]]
46 ; CHECK-NEXT: [[B:%.*]] = phi i64 [ 5, [[BRANCH_0]] ], [ 9, [[BRANCH_2]] ], [ 2, [[BRANCH_4]] ], [ 7, [[BRANCH_6]] ], [ 3, [[DEFAULT_BRANCH]] ]
47 ; CHECK-NEXT: ret i64 [[B]]
49 switch i64 %a, label %default_branch [
50 i64 0, label %branch_0
51 i64 2, label %branch_2
52 i64 4, label %branch_4
53 i64 6, label %branch_6
72 %b = phi i64 [ 5, %branch_0 ], [ 9, %branch_2 ], [ 2, %branch_4 ], [ 7, %branch_6 ], [ 3, %default_branch ]
76 define i64 @bar2(i64 %a) {
77 ; CHECK-LABEL: define i64 @bar2(
78 ; CHECK-SAME: i64 [[A:%.*]]) {
79 ; CHECK-NEXT: switch i64 [[A]], label [[UNREACHABLEDEFAULT:%.*]] [
80 ; CHECK-NEXT: i64 0, label [[BRANCH_0:%.*]]
81 ; CHECK-NEXT: i64 2, label [[BRANCH_2:%.*]]
82 ; CHECK-NEXT: i64 4, label [[BRANCH_4:%.*]]
83 ; CHECK-NEXT: i64 6, label [[BRANCH_6:%.*]]
86 ; CHECK-NEXT: br label [[EXIT:%.*]]
88 ; CHECK-NEXT: br label [[EXIT]]
90 ; CHECK-NEXT: br label [[EXIT]]
92 ; CHECK-NEXT: br label [[EXIT]]
93 ; CHECK: unreachabledefault:
94 ; CHECK-NEXT: unreachable
96 ; CHECK-NEXT: [[B:%.*]] = phi i64 [ 5, [[BRANCH_0]] ], [ 9, [[BRANCH_2]] ], [ 2, [[BRANCH_4]] ], [ 7, [[BRANCH_6]] ]
97 ; CHECK-NEXT: ret i64 [[B]]
99 switch i64 %a, label %unreachabledefault [
100 i64 0, label %branch_0
101 i64 2, label %branch_2
102 i64 4, label %branch_4
103 i64 6, label %branch_6
122 %b = phi i64 [ 5, %branch_0 ], [ 9, %branch_2 ], [ 2, %branch_4 ], [ 7, %branch_6 ]