1
- ; RUN: opt -S -passes=aggressive-instcombine -strncmp-inline-threshold=3 < %s | FileCheck %s
2
- ; RUN: opt -S -passes=aggressive-instcombine -strncmp-inline-threshold=2 < %s | FileCheck --check-prefix TH-2 %s
3
- ; RUN: opt -S -passes=aggressive-instcombine -strncmp-inline-threshold=1 < %s | FileCheck --check-prefix TH-1 %s
4
- ; RUN: opt -S -passes=aggressive-instcombine -strncmp-inline-threshold=0 < %s | FileCheck --check-prefix TH-0 %s
1
+ ; RUN: opt -S -passes=aggressive-instcombine -strncmp-inline-threshold=3 < %s | FileCheck --check-prefixes=CHECK,TH-3 %s
2
+ ; RUN: opt -S -passes=aggressive-instcombine -strncmp-inline-threshold=2 < %s | FileCheck --check-prefixes=CHECK, TH-2 %s
3
+ ; RUN: opt -S -passes=aggressive-instcombine -strncmp-inline-threshold=1 < %s | FileCheck --check-prefixes=CHECK, TH-1 %s
4
+ ; RUN: opt -S -passes=aggressive-instcombine -strncmp-inline-threshold=0 < %s | FileCheck --check-prefixes=CHECK, TH-0 %s
5
5
6
6
declare i32 @strcmp (ptr nocapture , ptr nocapture )
7
7
declare i32 @strncmp (ptr nocapture , ptr nocapture , i64 )
@@ -12,152 +12,136 @@ declare i32 @strncmp(ptr nocapture, ptr nocapture, i64)
12
12
@s4 = constant [4 x i8 ] c "aab\00 " , align 1
13
13
14
14
; strncmp(s, "aa", 1)
15
- define i1 @test_strncmp_0 (i8* nocapture readonly %s ) {
15
+ define i1 @test_strncmp_0 (i8* %s ) {
16
16
entry:
17
17
%call = tail call i32 @strncmp (ptr nonnull dereferenceable (1 ) %s , ptr nonnull dereferenceable (3 ) @s3 , i64 1 )
18
18
%cmp = icmp eq i32 %call , 0
19
19
ret i1 %cmp
20
20
}
21
21
; CHECK-LABEL: @test_strncmp_0(
22
- ; CHECK : @strncmp
22
+ ; TH-3 : @strncmp
23
23
24
24
; strncmp(s, "aa", 2)
25
- define i1 @test_strncmp_1 (i8* nocapture readonly %s ) {
25
+ define i1 @test_strncmp_1 (i8* %s ) {
26
26
entry:
27
27
%call = tail call i32 @strncmp (ptr nonnull dereferenceable (1 ) %s , ptr nonnull dereferenceable (3 ) @s3 , i64 2 )
28
28
%cmp = icmp eq i32 %call , 0
29
29
ret i1 %cmp
30
30
}
31
31
; CHECK-LABEL: @test_strncmp_1(
32
- ; CHECK-NOT: @strncmp
33
-
34
- ; TH-2-LABEL: @test_strncmp_1(
32
+ ; TH-3-NOT: @strncmp
35
33
; TH-2-NOT: @strncmp
36
- ; TH-1-LABEL: @test_strncmp_1(
37
34
; TH-1: @strncmp
38
- ; TH-0-LABEL: @test_strncmp_1(
39
35
; TH-0: @strncmp
40
36
41
- define i1 @test_strncmp_1_dereferenceable (i8* nocapture readonly dereferenceable (2 ) %s ) {
37
+ define i1 @test_strncmp_1_dereferenceable (i8* dereferenceable (2 ) %s ) {
42
38
entry:
43
39
%call = tail call i32 @strncmp (ptr nonnull %s , ptr nonnull dereferenceable (3 ) @s3 , i64 2 )
44
40
%cmp = icmp eq i32 %call , 0
45
41
ret i1 %cmp
46
42
}
47
43
; CHECK-LABEL: @test_strncmp_1_dereferenceable(
48
- ; CHECK: @strncmp
49
-
50
- ; TH-2-LABEL: @test_strncmp_1_dereferenceable(
51
- ; TH-1-LABEL: @test_strncmp_1_dereferenceable(
52
- ; TH-0-LABEL: @test_strncmp_1_dereferenceable(
44
+ ; TH-3: @strncmp
53
45
54
- define i32 @test_strncmp_1_not_comparision (i8* nocapture readonly %s ) {
46
+ define i32 @test_strncmp_1_not_comparision (i8* %s ) {
55
47
entry:
56
48
%call = tail call i32 @strncmp (ptr nonnull dereferenceable (1 ) %s , ptr nonnull dereferenceable (3 ) @s3 , i64 2 )
57
49
ret i32 %call
58
50
}
59
51
; CHECK-LABEL: @test_strncmp_1_not_comparision(
60
- ; CHECK : @strncmp
52
+ ; TH-3 : @strncmp
61
53
62
54
; strncmp(s, "aa", 3)
63
- define i1 @test_strncmp_2 (i8* nocapture readonly %s ) {
55
+ define i1 @test_strncmp_2 (i8* %s ) {
64
56
entry:
65
57
%call = tail call i32 @strncmp (ptr nonnull dereferenceable (1 ) %s , ptr nonnull dereferenceable (3 ) @s3 , i64 3 )
66
58
%cmp = icmp eq i32 %call , 0
67
59
ret i1 %cmp
68
60
}
69
61
; CHECK-LABEL: @test_strncmp_2(
70
- ; CHECK-NOT: @strncmp
71
-
72
- ; TH-2-LABEL: @test_strncmp_2(
62
+ ; TH-3-NOT: @strncmp
73
63
; TH-2: @strncmp
74
- ; TH-1-LABEL: @test_strncmp_2(
75
64
; TH-1: @strncmp
76
- ; TH-0-LABEL: @test_strncmp_2(
77
65
; TH-0: @strncmp
78
66
79
67
; strncmp(s, "aab", 3)
80
- define i1 @test_strncmp_3 (i8* nocapture readonly %s ) {
68
+ define i1 @test_strncmp_3 (i8* %s ) {
81
69
entry:
82
70
%call = tail call i32 @strncmp (ptr nonnull dereferenceable (1 ) %s , ptr nonnull dereferenceable (4 ) @s4 , i64 3 )
83
71
%cmp = icmp eq i32 %call , 0
84
72
ret i1 %cmp
85
73
}
86
74
; CHECK-LABEL: @test_strncmp_3(
87
- ; CHECK-NOT: @strncmp
88
-
89
- ; TH-2-LABEL: @test_strncmp_3(
90
- ; TH-1-LABEL: @test_strncmp_3(
91
- ; TH-0-LABEL: @test_strncmp_3(
75
+ ; TH-3-NOT: @strncmp
92
76
93
77
; strncmp(s, "aab", 4)
94
- define i1 @test_strncmp_4 (i8* nocapture readonly %s ) {
78
+ define i1 @test_strncmp_4 (i8* %s ) {
95
79
entry:
96
80
%call = tail call i32 @strncmp (ptr nonnull dereferenceable (1 ) %s , ptr nonnull dereferenceable (4 ) @s4 , i64 4 )
97
81
%cmp = icmp eq i32 %call , 0
98
82
ret i1 %cmp
99
83
}
100
84
; CHECK-LABEL: @test_strncmp_4(
101
- ; CHECK : @strncmp
85
+ ; TH-3 : @strncmp
102
86
103
87
; strncmp(s, "aa", 2)
104
- define i1 @test_strncmp_5 (i8* nocapture readonly %s ) {
88
+ define i1 @test_strncmp_5 (i8* %s ) {
105
89
entry:
106
90
%call = tail call i32 @strncmp (ptr nonnull dereferenceable (1 ) %s , ptr nonnull dereferenceable (3 ) @s3 , i64 2 )
107
91
%cmp = icmp eq i32 %call , 0
108
92
ret i1 %cmp
109
93
}
110
94
; CHECK-LABEL: @test_strncmp_5(
111
- ; CHECK -NOT: @strncmp
95
+ ; TH-3 -NOT: @strncmp
112
96
113
97
; char s2[] = {'a', 'a'}
114
98
; strncmp(s1, s2, 2)
115
- define i1 @test_strncmp_6 (i8* nocapture readonly %s1 ) {
99
+ define i1 @test_strncmp_6 (i8* %s1 ) {
116
100
entry:
117
101
%call = tail call i32 @strncmp (ptr nonnull dereferenceable (1 ) %s1 , ptr nonnull dereferenceable (3 ) @s2n , i64 2 )
118
102
%cmp = icmp eq i32 %call , 0
119
103
ret i1 %cmp
120
104
}
121
105
; CHECK-LABEL: @test_strncmp_6(
122
- ; CHECK -NOT: @strncmp
106
+ ; TH-3 -NOT: @strncmp
123
107
124
108
; char s2[] = {'a', 'a'}
125
109
; strncmp(s1, s2, 3)
126
- define i1 @test_strncmp_7 (i8* nocapture readonly %s1 ) {
110
+ define i1 @test_strncmp_7 (i8* %s1 ) {
127
111
entry:
128
112
%call = tail call i32 @strncmp (ptr nonnull dereferenceable (1 ) %s1 , ptr nonnull dereferenceable (3 ) @s2n , i64 3 )
129
113
%cmp = icmp eq i32 %call , 0
130
114
ret i1 %cmp
131
115
}
132
116
; CHECK-LABEL: @test_strncmp_7(
133
- ; CHECK : @strncmp
117
+ ; TH-3 : @strncmp
134
118
135
119
; strcmp(s, "")
136
- define i1 @test_strcmp_0 (i8* nocapture readonly %s ) {
120
+ define i1 @test_strcmp_0 (i8* %s ) {
137
121
entry:
138
122
%call = tail call i32 @strcmp (ptr nonnull dereferenceable (1 ) %s , ptr nonnull dereferenceable (1 ) @s1 )
139
123
%cmp = icmp eq i32 %call , 0
140
124
ret i1 %cmp
141
125
}
142
126
; CHECK-LABEL: @test_strcmp_0(
143
- ; CHECK : @strcmp
127
+ ; TH-3 : @strcmp
144
128
145
129
; strcmp(s, "aa")
146
- define i1 @test_strcmp_1 (i8* nocapture readonly %s ) {
130
+ define i1 @test_strcmp_1 (i8* %s ) {
147
131
entry:
148
132
%call = tail call i32 @strcmp (ptr nonnull dereferenceable (1 ) %s , ptr nonnull dereferenceable (3 ) @s3 )
149
133
%cmp = icmp eq i32 %call , 0
150
134
ret i1 %cmp
151
135
}
152
136
; CHECK-LABEL: @test_strcmp_1(
153
- ; CHECK -NOT: @strcmp
137
+ ; TH-3 -NOT: @strcmp
154
138
155
139
; strcmp(s, "aab")
156
- define i1 @test_strcmp_2 (i8* nocapture readonly %s ) {
140
+ define i1 @test_strcmp_2 (i8* %s ) {
157
141
entry:
158
142
%call = tail call i32 @strcmp (ptr nonnull dereferenceable (1 ) %s , ptr nonnull dereferenceable (4 ) @s4 )
159
143
%cmp = icmp eq i32 %call , 0
160
144
ret i1 %cmp
161
145
}
162
146
; CHECK-LABEL: @test_strcmp_2(
163
- ; CHECK : @strcmp
147
+ ; TH-3 : @strcmp
0 commit comments