1
+ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
1
2
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
2
3
3
4
target datalayout = "e-p:32:32"
4
5
target triple = "i686-pc-linux-gnu"
5
6
6
7
define i32 @main () {
7
- ; CHECK-LABEL: @main
8
- ; CHECK: %[[call:.*]] = call ptr @ctime(ptr null)
9
- ; CHECK: %[[cast:.*]] = ptrtoint ptr %[[call]] to i32
10
- ; CHECK: ret i32 %[[cast]]
8
+ ; CHECK-LABEL: define i32 @main() {
9
+ ; CHECK-NEXT: [[ENTRY:.*:]]
10
+ ; CHECK-NEXT: [[TMP:%.*]] = call ptr @ctime(ptr null)
11
+ ; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint ptr [[TMP]] to i32
12
+ ; CHECK-NEXT: ret i32 [[TMP0]]
13
+ ;
11
14
entry:
12
15
%tmp = call i32 @ctime ( ptr null ) ; <i32> [#uses=1]
13
16
ret i32 %tmp
@@ -16,13 +19,21 @@ entry:
16
19
declare ptr @ctime (ptr )
17
20
18
21
define internal { i8 } @foo (ptr ) {
22
+ ; CHECK-LABEL: define internal { i8 } @foo(
23
+ ; CHECK-SAME: ptr [[TMP0:%.*]]) {
24
+ ; CHECK-NEXT: [[ENTRY:.*:]]
25
+ ; CHECK-NEXT: ret { i8 } zeroinitializer
26
+ ;
19
27
entry:
20
28
ret { i8 } { i8 0 }
21
29
}
22
30
23
31
define void @test_struct_ret () {
24
- ; CHECK-LABEL: @test_struct_ret
25
- ; CHECK-NOT: bitcast
32
+ ; CHECK-LABEL: define void @test_struct_ret() {
33
+ ; CHECK-NEXT: [[ENTRY:.*:]]
34
+ ; CHECK-NEXT: [[TMP0:%.*]] = call { i8 } @foo(ptr null)
35
+ ; CHECK-NEXT: ret void
36
+ ;
26
37
entry:
27
38
%0 = call { i8 } @foo (ptr null )
28
39
ret void
@@ -31,10 +42,13 @@ entry:
31
42
declare i32 @fn1 (i32 )
32
43
33
44
define i32 @test1 (ptr %a ) {
34
- ; CHECK-LABEL: @test1
35
- ; CHECK: %[[cast:.*]] = ptrtoint ptr %a to i32
36
- ; CHECK-NEXT: %[[call:.*]] = tail call i32 @fn1(i32 %[[cast]])
37
- ; CHECK-NEXT: ret i32 %[[call]]
45
+ ; CHECK-LABEL: define i32 @test1(
46
+ ; CHECK-SAME: ptr [[A:%.*]]) {
47
+ ; CHECK-NEXT: [[ENTRY:.*:]]
48
+ ; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint ptr [[A]] to i32
49
+ ; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @fn1(i32 [[TMP0]])
50
+ ; CHECK-NEXT: ret i32 [[CALL]]
51
+ ;
38
52
entry:
39
53
%call = tail call i32 @fn1 (ptr %a )
40
54
ret i32 %call
@@ -43,9 +57,12 @@ entry:
43
57
declare i32 @fn2 (i16 )
44
58
45
59
define i32 @test2 (ptr %a ) {
46
- ; CHECK-LABEL: @test2
47
- ; CHECK: %[[call:.*]] = tail call i32 @fn2(ptr %a)
48
- ; CHECK-NEXT: ret i32 %[[call]]
60
+ ; CHECK-LABEL: define i32 @test2(
61
+ ; CHECK-SAME: ptr [[A:%.*]]) {
62
+ ; CHECK-NEXT: [[ENTRY:.*:]]
63
+ ; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @fn2(ptr [[A]])
64
+ ; CHECK-NEXT: ret i32 [[CALL]]
65
+ ;
49
66
entry:
50
67
%call = tail call i32 @fn2 (ptr %a )
51
68
ret i32 %call
@@ -54,9 +71,12 @@ entry:
54
71
declare i32 @fn3 (i64 )
55
72
56
73
define i32 @test3 (ptr %a ) {
57
- ; CHECK-LABEL: @test3
58
- ; CHECK: %[[call:.*]] = tail call i32 @fn3(ptr %a)
59
- ; CHECK-NEXT: ret i32 %[[call]]
74
+ ; CHECK-LABEL: define i32 @test3(
75
+ ; CHECK-SAME: ptr [[A:%.*]]) {
76
+ ; CHECK-NEXT: [[ENTRY:.*:]]
77
+ ; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @fn3(ptr [[A]])
78
+ ; CHECK-NEXT: ret i32 [[CALL]]
79
+ ;
60
80
entry:
61
81
%call = tail call i32 @fn3 (ptr %a )
62
82
ret i32 %call
@@ -65,9 +85,12 @@ entry:
65
85
declare i32 @fn4 (i32 ) "thunk"
66
86
67
87
define i32 @test4 (ptr %a ) {
68
- ; CHECK-LABEL: @test4
69
- ; CHECK: %[[call:.*]] = tail call i32 @fn4(ptr %a)
70
- ; CHECK-NEXT: ret i32 %[[call]]
88
+ ; CHECK-LABEL: define i32 @test4(
89
+ ; CHECK-SAME: ptr [[A:%.*]]) {
90
+ ; CHECK-NEXT: [[ENTRY:.*:]]
91
+ ; CHECK-NEXT: [[CALL:%.*]] = tail call i32 @fn4(ptr [[A]])
92
+ ; CHECK-NEXT: ret i32 [[CALL]]
93
+ ;
71
94
entry:
72
95
%call = tail call i32 @fn4 (ptr %a )
73
96
ret i32 %call
@@ -76,9 +99,14 @@ entry:
76
99
declare i1 @fn5 (ptr byval ({ i32 , i32 }) align 4 %r )
77
100
78
101
define i1 @test5 () {
79
- ; CHECK-LABEL: @test5
80
- ; CHECK: %[[call:.*]] = call i1 @fn5(i32 {{.*}}, i32 {{.*}})
81
- ; CHECK-NEXT: ret i1 %[[call]]
102
+ ; CHECK-LABEL: define i1 @test5() {
103
+ ; CHECK-NEXT: [[TMP1:%.*]] = alloca { i32, i32 }, align 4
104
+ ; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
105
+ ; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[TMP1]], i32 4
106
+ ; CHECK-NEXT: [[TMP4:%.*]] = load i32, ptr [[TMP3]], align 4
107
+ ; CHECK-NEXT: [[TMP5:%.*]] = call i1 @fn5(i32 [[TMP2]], i32 [[TMP4]])
108
+ ; CHECK-NEXT: ret i1 [[TMP5]]
109
+ ;
82
110
%1 = alloca { i32 , i32 }, align 4
83
111
%2 = getelementptr inbounds { i32 , i32 }, ptr %1 , i32 0 , i32 0
84
112
%3 = load i32 , ptr %2 , align 4
@@ -87,3 +115,16 @@ define i1 @test5() {
87
115
%6 = call i1 @fn5 (i32 %3 , i32 %5 )
88
116
ret i1 %6
89
117
}
118
+
119
+ declare void @bundles_callee (i32 )
120
+
121
+ define void @bundles () {
122
+ ; CHECK-LABEL: define void @bundles() {
123
+ ; CHECK-NEXT: [[ENTRY:.*:]]
124
+ ; CHECK-NEXT: call void @bundles_callee(i32 0) [ "deopt"() ]
125
+ ; CHECK-NEXT: ret void
126
+ ;
127
+ entry:
128
+ call void @bundles_callee () [ "deopt" () ]
129
+ ret void
130
+ }
0 commit comments