@@ -19,7 +19,7 @@ define i32 @test0-range-check(ptr %p) {
19
19
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read)
20
20
; TUNIT-LABEL: define {{[^@]+}}@test0-range-check
21
21
; TUNIT-SAME: (ptr nofree readonly align 4 captures(none) [[P:%.*]]) #[[ATTR0]] {
22
- ; TUNIT-NEXT: [[A:%.*]] = tail call i32 @test0(ptr nofree noundef readonly align 4 captures(none) [[P]]) #[[ATTR3:[0-9]+]], !range [[RNG0 ]]
22
+ ; TUNIT-NEXT: [[A:%.*]] = tail call range( i32 0, 10) i32 @test0(ptr nofree noundef readonly align 4 captures(none) [[P]]) #[[ATTR3:[0-9]+]]
23
23
; TUNIT-NEXT: ret i32 [[A]]
24
24
;
25
25
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read)
@@ -32,6 +32,40 @@ define i32 @test0-range-check(ptr %p) {
32
32
ret i32 %a
33
33
}
34
34
35
+ define i32 @test0-range-check-smaller-current-range-attr (ptr %p ) {
36
+ ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read)
37
+ ; TUNIT-LABEL: define {{[^@]+}}@test0-range-check-smaller-current-range-attr
38
+ ; TUNIT-SAME: (ptr nofree readonly align 4 captures(none) [[P:%.*]]) #[[ATTR0]] {
39
+ ; TUNIT-NEXT: [[A:%.*]] = tail call range(i32 2, 5) i32 @test0(ptr nofree noundef readonly align 4 captures(none) [[P]]) #[[ATTR3]]
40
+ ; TUNIT-NEXT: ret i32 [[A]]
41
+ ;
42
+ ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read)
43
+ ; CGSCC-LABEL: define {{[^@]+}}@test0-range-check-smaller-current-range-attr
44
+ ; CGSCC-SAME: (ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[P:%.*]]) #[[ATTR1]] {
45
+ ; CGSCC-NEXT: [[A:%.*]] = tail call range(i32 2, 5) i32 @test0(ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[P]]) #[[ATTR5]]
46
+ ; CGSCC-NEXT: ret i32 [[A]]
47
+ ;
48
+ %a = tail call range(i32 2 , 5 ) i32 @test0 (ptr %p )
49
+ ret i32 %a
50
+ }
51
+
52
+ define i32 @test0-range-check-larger-current-range-attr (ptr %p ) {
53
+ ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read)
54
+ ; TUNIT-LABEL: define {{[^@]+}}@test0-range-check-larger-current-range-attr
55
+ ; TUNIT-SAME: (ptr nofree readonly align 4 captures(none) [[P:%.*]]) #[[ATTR0]] {
56
+ ; TUNIT-NEXT: [[A:%.*]] = tail call range(i32 0, 10) i32 @test0(ptr nofree noundef readonly align 4 captures(none) [[P]]) #[[ATTR3]]
57
+ ; TUNIT-NEXT: ret i32 [[A]]
58
+ ;
59
+ ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read)
60
+ ; CGSCC-LABEL: define {{[^@]+}}@test0-range-check-larger-current-range-attr
61
+ ; CGSCC-SAME: (ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[P:%.*]]) #[[ATTR1]] {
62
+ ; CGSCC-NEXT: [[A:%.*]] = tail call range(i32 0, 100) i32 @test0(ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[P]]) #[[ATTR5]]
63
+ ; CGSCC-NEXT: ret i32 [[A]]
64
+ ;
65
+ %a = tail call range(i32 0 , 100 ) i32 @test0 (ptr %p )
66
+ ret i32 %a
67
+ }
68
+
35
69
declare void @use3-dummy (i1 , i1 , i1 )
36
70
define void @use3 (i1 , i1 , i1 ) {
37
71
; CHECK-LABEL: define {{[^@]+}}@use3
@@ -48,7 +82,7 @@ define void @test0-icmp-check(ptr %p){
48
82
; ret = [0, 10)
49
83
; TUNIT-LABEL: define {{[^@]+}}@test0-icmp-check
50
84
; TUNIT-SAME: (ptr nofree readonly align 4 captures(none) [[P:%.*]]) {
51
- ; TUNIT-NEXT: [[RET:%.*]] = tail call i32 @test0(ptr nofree noundef readonly align 4 captures(none) [[P]]) #[[ATTR3]], !range [[RNG0 ]]
85
+ ; TUNIT-NEXT: [[RET:%.*]] = tail call range( i32 0, 10) i32 @test0(ptr nofree noundef readonly align 4 captures(none) [[P]]) #[[ATTR3]]
52
86
; TUNIT-NEXT: [[CMP_EQ_1:%.*]] = icmp eq i32 [[RET]], 10
53
87
; TUNIT-NEXT: [[CMP_EQ_2:%.*]] = icmp eq i32 [[RET]], 9
54
88
; TUNIT-NEXT: [[CMP_EQ_3:%.*]] = icmp eq i32 [[RET]], 8
@@ -284,7 +318,7 @@ define i1 @test1-check(ptr %p) {
284
318
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read)
285
319
; TUNIT-LABEL: define {{[^@]+}}@test1-check
286
320
; TUNIT-SAME: (ptr nofree readonly align 4 captures(none) [[P:%.*]]) #[[ATTR0]] {
287
- ; TUNIT-NEXT: [[RES:%.*]] = tail call i32 @test1(ptr nofree noundef readonly align 4 captures(none) [[P]]) #[[ATTR3]], !range [[RNG2:![0-9]+ ]]
321
+ ; TUNIT-NEXT: [[RES:%.*]] = tail call range( i32 200, 1091) i32 @test1(ptr nofree noundef readonly align 4 captures(none) [[P]]) #[[ATTR3]]
288
322
; TUNIT-NEXT: [[CMP:%.*]] = icmp eq i32 [[RES]], 500
289
323
; TUNIT-NEXT: ret i1 [[CMP]]
290
324
;
@@ -624,7 +658,7 @@ define dso_local i32 @test4-g2(i32 %u) {
624
658
; TUNIT-LABEL: define {{[^@]+}}@test4-g2
625
659
; TUNIT-SAME: (i32 [[U:%.*]]) #[[ATTR1]] {
626
660
; TUNIT-NEXT: entry:
627
- ; TUNIT-NEXT: [[CALL:%.*]] = tail call i32 @test4-f2(i32 [[U]]) #[[ATTR4]], !range [[RNG3:![0-9]+ ]]
661
+ ; TUNIT-NEXT: [[CALL:%.*]] = tail call range( i32 1, -2147483648) i32 @test4-f2(i32 [[U]]) #[[ATTR4]]
628
662
; TUNIT-NEXT: ret i32 [[CALL]]
629
663
;
630
664
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
@@ -1760,6 +1794,7 @@ declare void @barney(i32 signext, i32 signext)
1760
1794
1761
1795
!0 = !{i32 0 , i32 10 }
1762
1796
!1 = !{i32 10 , i32 100 }
1797
+ !2 = !{i32 2 , i32 5 }
1763
1798
;.
1764
1799
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
1765
1800
; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
@@ -1778,8 +1813,6 @@ declare void @barney(i32 signext, i32 signext)
1778
1813
;.
1779
1814
; TUNIT: [[RNG0]] = !{i32 0, i32 10}
1780
1815
; TUNIT: [[RNG1]] = !{i32 10, i32 100}
1781
- ; TUNIT: [[RNG2]] = !{i32 200, i32 1091}
1782
- ; TUNIT: [[RNG3]] = !{i32 1, i32 -2147483648}
1783
1816
;.
1784
1817
; CGSCC: [[RNG0]] = !{i32 0, i32 10}
1785
1818
; CGSCC: [[RNG1]] = !{i32 10, i32 100}
0 commit comments