llvm.org GIT mirror llvm / 85a2f58
[Tests] Adjust LFTR dead-iv tests to bypass undef cases As pointed out by Nikita in review, undef and poison need to be handled separately. Since we're no longer expecting any test improvements - just fixes for miscompiles - update the tests to bypass the existing undef check. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363002 91177308-0d34-0410-b5e6-96231b3b80d8 Philip Reames 3 months ago
1 changed file(s) with 35 addition(s) and 41 deletion(s). Raw diff Collapse all Expand all
1919 ;; IV which dependends on that poison computation in a manner which might
2020 ;; trigger UB would be incorrect.
2121 ;; FIXME: This currently shows a miscompile!
22 define void @neg_dynamically_dead_inbounds(i8* %a, i8** %x, i1 %always_false) #0 {
22 define void @neg_dynamically_dead_inbounds(i1 %always_false) #0 {
2323 ; CHECK-LABEL: @neg_dynamically_dead_inbounds(
2424 ; CHECK-NEXT: entry:
2525 ; CHECK-NEXT: br label [[LOOP:%.*]]
101101 ret void
102102 }
103103
104 define void @dom_store_preinc(i8* %a) #0 {
104 define void @dom_store_preinc() #0 {
105105 ; CHECK-LABEL: @dom_store_preinc(
106106 ; CHECK-NEXT: entry:
107107 ; CHECK-NEXT: br label [[LOOP:%.*]]
108108 ; CHECK: loop:
109 ; CHECK-NEXT: [[I_0:%.*]] = phi i8 [ 0, [[ENTRY:%.*]] ], [ [[TMP4:%.*]], [[LOOP]] ]
110 ; CHECK-NEXT: [[P_0:%.*]] = phi i8* [ [[A:%.*]], [[ENTRY]] ], [ [[TMP3:%.*]], [[LOOP]] ]
109 ; CHECK-NEXT: [[P_0:%.*]] = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), [[ENTRY:%.*]] ], [ [[TMP3:%.*]], [[LOOP]] ]
111110 ; CHECK-NEXT: store volatile i8 0, i8* [[P_0]]
112111 ; CHECK-NEXT: [[TMP3]] = getelementptr inbounds i8, i8* [[P_0]], i64 1
113 ; CHECK-NEXT: [[TMP4]] = add nuw i8 [[I_0]], 1
114 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8 [[TMP4]], -10
115 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[EXIT:%.*]]
116 ; CHECK: exit:
117 ; CHECK-NEXT: ret void
118 ;
119 entry:
120 br label %loop
121
122 loop:
123 %i.0 = phi i8 [ 0, %entry ], [ %tmp4, %loop ]
124 %p.0 = phi i8* [ %a, %entry ], [ %tmp3, %loop ]
112 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8* [[TMP3]], getelementptr (i8, i8* getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), i64 246)
113 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[EXIT:%.*]]
114 ; CHECK: exit:
115 ; CHECK-NEXT: ret void
116 ;
117 entry:
118 br label %loop
119
120 loop:
121 %i.0 = phi i8 [ 0, %entry ], [ %tmp4, %loop ]
122 %p.0 = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), %entry ], [ %tmp3, %loop ]
125123 store volatile i8 0, i8* %p.0
126124 %tmp3 = getelementptr inbounds i8, i8* %p.0, i64 1
127125 %tmp4 = add i8 %i.0, 1
132130 ret void
133131 }
134132
135 define void @dom_store_postinc(i8* %a) #0 {
133 define void @dom_store_postinc() #0 {
136134 ; CHECK-LABEL: @dom_store_postinc(
137135 ; CHECK-NEXT: entry:
138136 ; CHECK-NEXT: br label [[LOOP:%.*]]
139137 ; CHECK: loop:
140 ; CHECK-NEXT: [[I_0:%.*]] = phi i8 [ 0, [[ENTRY:%.*]] ], [ [[TMP4:%.*]], [[LOOP]] ]
141 ; CHECK-NEXT: [[P_0:%.*]] = phi i8* [ [[A:%.*]], [[ENTRY]] ], [ [[TMP3:%.*]], [[LOOP]] ]
138 ; CHECK-NEXT: [[P_0:%.*]] = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), [[ENTRY:%.*]] ], [ [[TMP3:%.*]], [[LOOP]] ]
142139 ; CHECK-NEXT: [[TMP3]] = getelementptr inbounds i8, i8* [[P_0]], i64 1
143140 ; CHECK-NEXT: store volatile i8 0, i8* [[TMP3]]
144 ; CHECK-NEXT: [[TMP4]] = add nuw i8 [[I_0]], 1
145 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8 [[TMP4]], -10
146 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[EXIT:%.*]]
147 ; CHECK: exit:
148 ; CHECK-NEXT: ret void
149 ;
150 entry:
151 br label %loop
152
153 loop:
154 %i.0 = phi i8 [ 0, %entry ], [ %tmp4, %loop ]
155 %p.0 = phi i8* [ %a, %entry ], [ %tmp3, %loop ]
141 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8* [[TMP3]], getelementptr (i8, i8* getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), i64 246)
142 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[EXIT:%.*]]
143 ; CHECK: exit:
144 ; CHECK-NEXT: ret void
145 ;
146 entry:
147 br label %loop
148
149 loop:
150 %i.0 = phi i8 [ 0, %entry ], [ %tmp4, %loop ]
151 %p.0 = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), %entry ], [ %tmp3, %loop ]
156152 %tmp3 = getelementptr inbounds i8, i8* %p.0, i64 1
157153 store volatile i8 0, i8* %tmp3
158154 %tmp4 = add i8 %i.0, 1
163159 ret void
164160 }
165161
166 define i8 @dom_load(i8* %a) #0 {
162 define i8 @dom_load() #0 {
167163 ; CHECK-LABEL: @dom_load(
168164 ; CHECK-NEXT: entry:
169165 ; CHECK-NEXT: br label [[LOOP:%.*]]
170166 ; CHECK: loop:
171 ; CHECK-NEXT: [[I_0:%.*]] = phi i8 [ 0, [[ENTRY:%.*]] ], [ [[TMP4:%.*]], [[LOOP]] ]
172 ; CHECK-NEXT: [[P_0:%.*]] = phi i8* [ [[A:%.*]], [[ENTRY]] ], [ [[TMP3:%.*]], [[LOOP]] ]
167 ; CHECK-NEXT: [[P_0:%.*]] = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), [[ENTRY:%.*]] ], [ [[TMP3:%.*]], [[LOOP]] ]
173168 ; CHECK-NEXT: [[TMP3]] = getelementptr inbounds i8, i8* [[P_0]], i64 1
174169 ; CHECK-NEXT: [[V:%.*]] = load i8, i8* [[TMP3]]
175 ; CHECK-NEXT: [[TMP4]] = add nuw i8 [[I_0]], 1
176 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8 [[TMP4]], -10
170 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8* [[TMP3]], getelementptr (i8, i8* getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), i64 246)
177171 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[EXIT:%.*]]
178172 ; CHECK: exit:
179173 ; CHECK-NEXT: [[V_LCSSA:%.*]] = phi i8 [ [[V]], [[LOOP]] ]
184178
185179 loop:
186180 %i.0 = phi i8 [ 0, %entry ], [ %tmp4, %loop ]
187 %p.0 = phi i8* [ %a, %entry ], [ %tmp3, %loop ]
181 %p.0 = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), %entry ], [ %tmp3, %loop ]
188182 %tmp3 = getelementptr inbounds i8, i8* %p.0, i64 1
189183 %v = load i8, i8* %tmp3
190184 %tmp4 = add i8 %i.0, 1
195189 ret i8 %v
196190 }
197191
198 define i64 @dom_div(i64 %a) #0 {
192 define i64 @dom_div(i64 %input) #0 {
199193 ; CHECK-LABEL: @dom_div(
200194 ; CHECK-NEXT: entry:
201195 ; CHECK-NEXT: br label [[LOOP:%.*]]
202196 ; CHECK: loop:
203197 ; CHECK-NEXT: [[I_0:%.*]] = phi i8 [ 0, [[ENTRY:%.*]] ], [ [[TMP4:%.*]], [[LOOP]] ]
204 ; CHECK-NEXT: [[I_1:%.*]] = phi i64 [ [[A:%.*]], [[ENTRY]] ], [ [[TMP3:%.*]], [[LOOP]] ]
198 ; CHECK-NEXT: [[I_1:%.*]] = phi i64 [ [[INPUT:%.*]], [[ENTRY]] ], [ [[TMP3:%.*]], [[LOOP]] ]
205199 ; CHECK-NEXT: [[TMP3]] = add nuw nsw i64 [[I_1]], 1
206200 ; CHECK-NEXT: [[V:%.*]] = udiv i64 5, [[TMP3]]
207201 ; CHECK-NEXT: [[TMP4]] = add nuw i8 [[I_0]], 1
216210
217211 loop:
218212 %i.0 = phi i8 [ 0, %entry ], [ %tmp4, %loop ]
219 %i.1 = phi i64 [ %a, %entry ], [ %tmp3, %loop ]
213 %i.1 = phi i64 [ %input, %entry ], [ %tmp3, %loop ]
220214 %tmp3 = add nsw nuw i64 %i.1, 1
221215 %v = udiv i64 5, %tmp3
222216 %tmp4 = add i8 %i.0, 1
229223
230224 ; For integer IVs, we handle this trigger case by stripping the problematic
231225 ; flags which removes the potential introduction of UB.
232 define void @neg_dead_int_iv(i64 %a) #0 {
226 define void @neg_dead_int_iv() #0 {
233227 ; CHECK-LABEL: @neg_dead_int_iv(
234228 ; CHECK-NEXT: entry:
235229 ; CHECK-NEXT: br label [[LOOP:%.*]]