@@ -19,7 +19,7 @@ define i32 @test0-range-check(ptr %p) {
1919; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 
2020; TUNIT-LABEL: define {{[^@]+}}@test0-range-check 
2121; 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]+]] 
2323; TUNIT-NEXT:    ret i32 [[A]] 
2424; 
2525; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read) 
@@ -32,6 +32,40 @@ define i32 @test0-range-check(ptr %p) {
3232  ret  i32  %a 
3333}
3434
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+ 
3569declare  void  @use3-dummy (i1 , i1 , i1 )
3670define  void  @use3 (i1 , i1 , i1 ) {
3771; CHECK-LABEL: define {{[^@]+}}@use3 
@@ -48,7 +82,7 @@ define void @test0-icmp-check(ptr %p){
4882  ; ret = [0, 10) 
4983; TUNIT-LABEL: define {{[^@]+}}@test0-icmp-check 
5084; 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]] 
5286; TUNIT-NEXT:    [[CMP_EQ_1:%.*]] = icmp eq i32 [[RET]], 10 
5387; TUNIT-NEXT:    [[CMP_EQ_2:%.*]] = icmp eq i32 [[RET]], 9 
5488; TUNIT-NEXT:    [[CMP_EQ_3:%.*]] = icmp eq i32 [[RET]], 8 
@@ -284,7 +318,7 @@ define i1 @test1-check(ptr %p) {
284318; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 
285319; TUNIT-LABEL: define {{[^@]+}}@test1-check 
286320; 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]] 
288322; TUNIT-NEXT:    [[CMP:%.*]] = icmp eq i32 [[RES]], 500 
289323; TUNIT-NEXT:    ret i1 [[CMP]] 
290324; 
@@ -624,7 +658,7 @@ define dso_local i32 @test4-g2(i32 %u) {
624658; TUNIT-LABEL: define {{[^@]+}}@test4-g2 
625659; TUNIT-SAME: (i32 [[U:%.*]]) #[[ATTR1]] { 
626660; 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]] 
628662; TUNIT-NEXT:    ret i32 [[CALL]] 
629663; 
630664; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) 
@@ -1760,6 +1794,7 @@ declare void @barney(i32 signext, i32 signext)
17601794
17611795!0  = !{i32  0 , i32  10 }
17621796!1  = !{i32  10 , i32  100 }
1797+ !2  = !{i32  2 , i32  5 }
17631798;. 
17641799; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) } 
17651800; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) } 
@@ -1778,8 +1813,6 @@ declare void @barney(i32 signext, i32 signext)
17781813;. 
17791814; TUNIT: [[RNG0]] = !{i32 0, i32 10} 
17801815; TUNIT: [[RNG1]] = !{i32 10, i32 100} 
1781- ; TUNIT: [[RNG2]] = !{i32 200, i32 1091} 
1782- ; TUNIT: [[RNG3]] = !{i32 1, i32 -2147483648} 
17831816;. 
17841817; CGSCC: [[RNG0]] = !{i32 0, i32 10} 
17851818; CGSCC: [[RNG1]] = !{i32 10, i32 100} 
0 commit comments