range_nw_flag.ll
4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
; RUN: opt < %s -S -analyze -scalar-evolution | FileCheck %s
; copied from flags-from-poison.ll
; CHECK-LABEL: @test-add-nuw
; CHECK: --> {(1 + %offset)<nuw>,+,1}<nuw><%loop> U: [1,0) S: [1,0)
define void @test-add-nuw(float* %input, i32 %offset, i32 %numIterations) {
entry:
br label %loop
loop:
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
%nexti = add nuw i32 %i, 1
%index32 = add nuw i32 %nexti, %offset
%ptr = getelementptr inbounds float, float* %input, i32 %index32
%f = load float, float* %ptr, align 4
%exitcond = icmp eq i32 %nexti, %numIterations
br i1 %exitcond, label %exit, label %loop
exit:
ret void
}
; CHECK-LABEL: @test-addrec-nuw
; CHECK: --> {(1 + (10 smax %offset))<nuw>,+,1}<nuw><%loop> U: [11,0) S: [11,0)
define void @test-addrec-nuw(float* %input, i32 %offset, i32 %numIterations) {
entry:
%cmp = icmp sgt i32 %offset, 10
%min.10 = select i1 %cmp, i32 %offset, i32 10
br label %loop
loop:
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
%nexti = add nuw i32 %i, 1
%index32 = add nuw i32 %nexti, %min.10
%ptr = getelementptr inbounds float, float* %input, i32 %index32
%f = load float, float* %ptr, align 4
%exitcond = icmp eq i32 %nexti, %numIterations
br i1 %exitcond, label %exit, label %loop
exit:
ret void
}
; CHECK-LABEL: @test-addrec-nsw-start-neg-strip-neg
; CHECK: --> {(-1 + (-10 smin %offset))<nsw>,+,-1}<nsw><%loop> U: [-2147483648,-10) S: [-2147483648,-10)
define void @test-addrec-nsw-start-neg-strip-neg(float* %input, i32 %offset, i32 %numIterations) {
entry:
%cmp = icmp slt i32 %offset, -10
%max = select i1 %cmp, i32 %offset, i32 -10
br label %loop
loop:
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
%nexti = add nsw i32 %i, -1
%index32 = add nsw i32 %nexti, %max
%ptr = getelementptr inbounds float, float* %input, i32 %index32
%f = load float, float* %ptr, align 4
%exitcond = icmp eq i32 %nexti, %numIterations
br i1 %exitcond, label %exit, label %loop
exit:
ret void
}
; CHECK-LABEL: @test-addrec-nsw-start-pos-strip-neg
; CHECK: --> {(-1 + (10 smin %offset))<nsw>,+,-1}<nsw><%loop> U: [-2147483648,10) S: [-2147483648,10)
define void @test-addrec-nsw-start-pos-strip-neg(float* %input, i32 %offset, i32 %numIterations) {
entry:
%cmp = icmp slt i32 %offset, 10
%max = select i1 %cmp, i32 %offset, i32 10
br label %loop
loop:
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
%nexti = add nsw i32 %i, -1
%index32 = add nsw i32 %nexti, %max
%ptr = getelementptr inbounds float, float* %input, i32 %index32
%f = load float, float* %ptr, align 4
%exitcond = icmp eq i32 %nexti, %numIterations
br i1 %exitcond, label %exit, label %loop
exit:
ret void
}
; CHECK-LABEL: @test-addrec-nsw-start-pos-strip-pos
; CHECK: --> {(1 + (10 smax %offset))<nuw><nsw>,+,1}<nuw><nsw><%loop> U: [11,-2147483648) S: [11,-2147483648)
define void @test-addrec-nsw-start-pos-strip-pos(float* %input, i32 %offset, i32 %numIterations) {
entry:
%cmp = icmp sgt i32 %offset, 10
%min = select i1 %cmp, i32 %offset, i32 10
br label %loop
loop:
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
%nexti = add nsw i32 %i, 1
%index32 = add nsw i32 %nexti, %min
%ptr = getelementptr inbounds float, float* %input, i32 %index32
%f = load float, float* %ptr, align 4
%exitcond = icmp eq i32 %nexti, %numIterations
br i1 %exitcond, label %exit, label %loop
exit:
ret void
}
; CHECK-LABEL: @test-addrec-nsw-start-neg-strip-pos
; CHECK: --> {(1 + (-10 smax %offset))<nsw>,+,1}<nsw><%loop> U: [-9,-2147483648) S: [-9,-2147483648)
define void @test-addrec-nsw-start-neg-strip-pos(float* %input, i32 %offset, i32 %numIterations) {
entry:
%cmp = icmp sgt i32 %offset, -10
%min = select i1 %cmp, i32 %offset, i32 -10
br label %loop
loop:
%i = phi i32 [ %nexti, %loop ], [ 0, %entry ]
%nexti = add nsw i32 %i, 1
%index32 = add nsw i32 %nexti, %min
%ptr = getelementptr inbounds float, float* %input, i32 %index32
%f = load float, float* %ptr, align 4
%exitcond = icmp eq i32 %nexti, %numIterations
br i1 %exitcond, label %exit, label %loop
exit:
ret void
}