Skip to content

Commit 6045a80

Browse files
committed
[Attributor] Check lines accidentally not committed with D76208
1 parent 6025fc2 commit 6045a80

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

llvm/test/Transforms/Attributor/dereferenceable-1.ll

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,38 @@ define void @deref_or_null_and_nonnull(i32* dereferenceable_or_null(100) %0) {
300300

301301
; FIXME: %ptr should be dereferenceable(31)
302302
define void @test8(i8* %ptr) #0 {
303+
; IS________OPM-LABEL: define {{[^@]+}}@test8
304+
; IS________OPM-SAME: (i8* nocapture nofree nonnull writeonly [[PTR:%.*]])
305+
; IS________OPM-NEXT: br label [[TMP1:%.*]]
306+
; IS________OPM: 1:
307+
; IS________OPM-NEXT: [[I_0:%.*]] = phi i32 [ 20, [[TMP0:%.*]] ], [ [[TMP4:%.*]], [[TMP5:%.*]] ]
308+
; IS________OPM-NEXT: [[TMP2:%.*]] = sext i32 [[I_0]] to i64
309+
; IS________OPM-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i64 [[TMP2]]
310+
; IS________OPM-NEXT: store i8 32, i8* [[TMP3]], align 1
311+
; IS________OPM-NEXT: [[TMP4]] = add nsw i32 [[I_0]], 1
312+
; IS________OPM-NEXT: br label [[TMP5]]
313+
; IS________OPM: 5:
314+
; IS________OPM-NEXT: [[TMP6:%.*]] = icmp slt i32 [[TMP4]], 30
315+
; IS________OPM-NEXT: br i1 [[TMP6]], label [[TMP1]], label [[TMP7:%.*]]
316+
; IS________OPM: 7:
317+
; IS________OPM-NEXT: ret void
318+
;
319+
; IS________NPM-LABEL: define {{[^@]+}}@test8
320+
; IS________NPM-SAME: (i8* nocapture nofree nonnull writeonly dereferenceable(21) [[PTR:%.*]])
321+
; IS________NPM-NEXT: br label [[TMP1:%.*]]
322+
; IS________NPM: 1:
323+
; IS________NPM-NEXT: [[I_0:%.*]] = phi i32 [ 20, [[TMP0:%.*]] ], [ [[TMP4:%.*]], [[TMP5:%.*]] ]
324+
; IS________NPM-NEXT: [[TMP2:%.*]] = sext i32 [[I_0]] to i64
325+
; IS________NPM-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i64 [[TMP2]]
326+
; IS________NPM-NEXT: store i8 32, i8* [[TMP3]], align 1
327+
; IS________NPM-NEXT: [[TMP4]] = add nsw i32 [[I_0]], 1
328+
; IS________NPM-NEXT: br label [[TMP5]]
329+
; IS________NPM: 5:
330+
; IS________NPM-NEXT: [[TMP6:%.*]] = icmp slt i32 [[TMP4]], 30
331+
; IS________NPM-NEXT: br i1 [[TMP6]], label [[TMP1]], label [[TMP7:%.*]]
332+
; IS________NPM: 7:
333+
; IS________NPM-NEXT: ret void
334+
;
303335
br label %1
304336
1: ; preds = %5, %0
305337
%i.0 = phi i32 [ 20, %0 ], [ %4, %5 ]
@@ -318,6 +350,13 @@ define void @test8(i8* %ptr) #0 {
318350

319351
; 8.2 (negative case)
320352
define void @test8_neg(i32 %i, i8* %ptr) #0 {
353+
; CHECK-LABEL: define {{[^@]+}}@test8_neg
354+
; CHECK-SAME: (i32 [[I:%.*]], i8* nocapture nofree nonnull writeonly [[PTR:%.*]])
355+
; CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[I]] to i64
356+
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i64 [[TMP1]]
357+
; CHECK-NEXT: store i8 65, i8* [[TMP2]], align 1
358+
; CHECK-NEXT: ret void
359+
;
321360
%1 = sext i32 %i to i64
322361
%2 = getelementptr inbounds i8, i8* %ptr, i64 %1
323362
store i8 65, i8* %2, align 1

0 commit comments

Comments
 (0)