; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
; FIXME: Figure out why we need 16 iterations here.
-declare void @deref_phi_user(i32* %a);
+declare void @deref_phi_user(ptr %a);
; TEST 1
; take mininimum of return values
;.
; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = global i64 0
;.
-define i32* @test1(i32* dereferenceable(4) %0, double* dereferenceable(8) %1, i1 zeroext %2) local_unnamed_addr {
+define ptr @test1(ptr dereferenceable(4) %0, ptr dereferenceable(8) %1, i1 zeroext %2) local_unnamed_addr {
; CHECK: Function Attrs: nofree norecurse nosync nounwind willreturn memory(none)
; CHECK-LABEL: define {{[^@]+}}@test1
-; CHECK-SAME: (i32* nofree nonnull readnone dereferenceable(4) "no-capture-maybe-returned" [[TMP0:%.*]], double* nofree nonnull readnone dereferenceable(8) "no-capture-maybe-returned" [[TMP1:%.*]], i1 zeroext [[TMP2:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
-; CHECK-NEXT: [[TMP4:%.*]] = bitcast double* [[TMP1]] to i32*
-; CHECK-NEXT: [[TMP5:%.*]] = select i1 [[TMP2]], i32* [[TMP0]], i32* [[TMP4]]
-; CHECK-NEXT: ret i32* [[TMP5]]
-;
- %4 = bitcast double* %1 to i32*
- %5 = select i1 %2, i32* %0, i32* %4
- ret i32* %5
+; CHECK-SAME: (ptr nofree nonnull readnone dereferenceable(4) "no-capture-maybe-returned" [[TMP0:%.*]], ptr nofree nonnull readnone dereferenceable(8) "no-capture-maybe-returned" [[TMP1:%.*]], i1 zeroext [[TMP2:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: [[TMP5:%.*]] = select i1 [[TMP2]], ptr [[TMP0]], ptr [[TMP1]]
+; CHECK-NEXT: ret ptr [[TMP5]]
+;
+ %4 = select i1 %2, ptr %0, ptr %1
+ ret ptr %4
}
; TEST 2
-define i32* @test2(i32* dereferenceable_or_null(4) %0, double* dereferenceable(8) %1, i1 zeroext %2) local_unnamed_addr {
+define ptr @test2(ptr dereferenceable_or_null(4) %0, ptr dereferenceable(8) %1, i1 zeroext %2) local_unnamed_addr {
; CHECK: Function Attrs: nofree norecurse nosync nounwind willreturn memory(none)
; CHECK-LABEL: define {{[^@]+}}@test2
-; CHECK-SAME: (i32* nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[TMP0:%.*]], double* nofree nonnull readnone dereferenceable(8) "no-capture-maybe-returned" [[TMP1:%.*]], i1 zeroext [[TMP2:%.*]]) local_unnamed_addr #[[ATTR0]] {
-; CHECK-NEXT: [[TMP4:%.*]] = bitcast double* [[TMP1]] to i32*
-; CHECK-NEXT: [[TMP5:%.*]] = select i1 [[TMP2]], i32* [[TMP0]], i32* [[TMP4]]
-; CHECK-NEXT: ret i32* [[TMP5]]
-;
- %4 = bitcast double* %1 to i32*
- %5 = select i1 %2, i32* %0, i32* %4
- ret i32* %5
+; CHECK-SAME: (ptr nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[TMP0:%.*]], ptr nofree nonnull readnone dereferenceable(8) "no-capture-maybe-returned" [[TMP1:%.*]], i1 zeroext [[TMP2:%.*]]) local_unnamed_addr #[[ATTR0]] {
+; CHECK-NEXT: [[TMP5:%.*]] = select i1 [[TMP2]], ptr [[TMP0]], ptr [[TMP1]]
+; CHECK-NEXT: ret ptr [[TMP5]]
+;
+ %4 = select i1 %2, ptr %0, ptr %1
+ ret ptr %4
}
; TEST 3
; GEP inbounds
-define i32* @test3_1(i32* dereferenceable(8) %0) local_unnamed_addr {
+define ptr @test3_1(ptr dereferenceable(8) %0) local_unnamed_addr {
; CHECK: Function Attrs: nofree norecurse nosync nounwind willreturn memory(none)
; CHECK-LABEL: define {{[^@]+}}@test3_1
-; CHECK-SAME: (i32* nofree nonnull readnone dereferenceable(8) "no-capture-maybe-returned" [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {
-; CHECK-NEXT: [[RET:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 1
-; CHECK-NEXT: ret i32* [[RET]]
+; CHECK-SAME: (ptr nofree nonnull readnone dereferenceable(8) "no-capture-maybe-returned" [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {
+; CHECK-NEXT: [[RET:%.*]] = getelementptr inbounds i32, ptr [[TMP0]], i64 1
+; CHECK-NEXT: ret ptr [[RET]]
;
- %ret = getelementptr inbounds i32, i32* %0, i64 1
- ret i32* %ret
+ %ret = getelementptr inbounds i32, ptr %0, i64 1
+ ret ptr %ret
}
-define i32* @test3_2(i32* dereferenceable_or_null(32) %0) local_unnamed_addr {
+define ptr @test3_2(ptr dereferenceable_or_null(32) %0) local_unnamed_addr {
; CHECK: Function Attrs: nofree norecurse nosync nounwind willreturn memory(none)
; CHECK-LABEL: define {{[^@]+}}@test3_2
-; CHECK-SAME: (i32* nofree readnone dereferenceable_or_null(32) "no-capture-maybe-returned" [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {
-; CHECK-NEXT: [[RET:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 4
-; CHECK-NEXT: ret i32* [[RET]]
+; CHECK-SAME: (ptr nofree readnone dereferenceable_or_null(32) "no-capture-maybe-returned" [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {
+; CHECK-NEXT: [[RET:%.*]] = getelementptr inbounds i32, ptr [[TMP0]], i64 4
+; CHECK-NEXT: ret ptr [[RET]]
;
- %ret = getelementptr inbounds i32, i32* %0, i64 4
- ret i32* %ret
+ %ret = getelementptr inbounds i32, ptr %0, i64 4
+ ret ptr %ret
}
-define i32* @test3_3(i32* dereferenceable(8) %0, i32* dereferenceable(16) %1, i1 %2) local_unnamed_addr {
+define ptr @test3_3(ptr dereferenceable(8) %0, ptr dereferenceable(16) %1, i1 %2) local_unnamed_addr {
; CHECK: Function Attrs: nofree norecurse nosync nounwind willreturn memory(none)
; CHECK-LABEL: define {{[^@]+}}@test3_3
-; CHECK-SAME: (i32* nofree nonnull readnone dereferenceable(8) "no-capture-maybe-returned" [[TMP0:%.*]], i32* nofree nonnull readnone dereferenceable(16) "no-capture-maybe-returned" [[TMP1:%.*]], i1 [[TMP2:%.*]]) local_unnamed_addr #[[ATTR0]] {
-; CHECK-NEXT: [[RET1:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 1
-; CHECK-NEXT: [[RET2:%.*]] = getelementptr inbounds i32, i32* [[TMP1]], i64 2
-; CHECK-NEXT: [[RET:%.*]] = select i1 [[TMP2]], i32* [[RET1]], i32* [[RET2]]
-; CHECK-NEXT: ret i32* [[RET]]
-;
- %ret1 = getelementptr inbounds i32, i32* %0, i64 1
- %ret2 = getelementptr inbounds i32, i32* %1, i64 2
- %ret = select i1 %2, i32* %ret1, i32* %ret2
- ret i32* %ret
+; CHECK-SAME: (ptr nofree nonnull readnone dereferenceable(8) "no-capture-maybe-returned" [[TMP0:%.*]], ptr nofree nonnull readnone dereferenceable(16) "no-capture-maybe-returned" [[TMP1:%.*]], i1 [[TMP2:%.*]]) local_unnamed_addr #[[ATTR0]] {
+; CHECK-NEXT: [[RET1:%.*]] = getelementptr inbounds i32, ptr [[TMP0]], i64 1
+; CHECK-NEXT: [[RET2:%.*]] = getelementptr inbounds i32, ptr [[TMP1]], i64 2
+; CHECK-NEXT: [[RET:%.*]] = select i1 [[TMP2]], ptr [[RET1]], ptr [[RET2]]
+; CHECK-NEXT: ret ptr [[RET]]
+;
+ %ret1 = getelementptr inbounds i32, ptr %0, i64 1
+ %ret2 = getelementptr inbounds i32, ptr %1, i64 2
+ %ret = select i1 %2, ptr %ret1, ptr %ret2
+ ret ptr %ret
}
; TEST 4
; Better than known in IR.
-define dereferenceable(4) i32* @test4(i32* dereferenceable(8) %0) local_unnamed_addr {
+define dereferenceable(4) ptr @test4(ptr dereferenceable(8) %0) local_unnamed_addr {
; CHECK: Function Attrs: nofree norecurse nosync nounwind willreturn memory(none)
; CHECK-LABEL: define {{[^@]+}}@test4
-; CHECK-SAME: (i32* nofree nonnull readnone returned dereferenceable(8) "no-capture-maybe-returned" [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {
-; CHECK-NEXT: ret i32* [[TMP0]]
+; CHECK-SAME: (ptr nofree nonnull readnone returned dereferenceable(8) "no-capture-maybe-returned" [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {
+; CHECK-NEXT: ret ptr [[TMP0]]
;
- ret i32* %0
+ ret ptr %0
}
; TEST 5
; loop in which dereferenceabily "grows"
-define void @deref_phi_growing(i32* dereferenceable(4000) %a) {
+define void @deref_phi_growing(ptr dereferenceable(4000) %a) {
; CHECK-LABEL: define {{[^@]+}}@deref_phi_growing
-; CHECK-SAME: (i32* nonnull dereferenceable(4000) [[A:%.*]]) {
+; CHECK-SAME: (ptr nonnull dereferenceable(4000) [[A:%.*]]) {
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[FOR_COND:%.*]]
; CHECK: for.cond:
; CHECK-NEXT: [[I_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[FOR_INC:%.*]] ]
-; CHECK-NEXT: [[A_ADDR_0:%.*]] = phi i32* [ [[A]], [[ENTRY]] ], [ [[INCDEC_PTR:%.*]], [[FOR_INC]] ]
-; CHECK-NEXT: call void @deref_phi_user(i32* nonnull dereferenceable(4000) [[A_ADDR_0]])
-; CHECK-NEXT: [[TMP:%.*]] = load i32, i32* [[A_ADDR_0]], align 4
+; CHECK-NEXT: [[A_ADDR_0:%.*]] = phi ptr [ [[A]], [[ENTRY]] ], [ [[INCDEC_PTR:%.*]], [[FOR_INC]] ]
+; CHECK-NEXT: call void @deref_phi_user(ptr nonnull dereferenceable(4000) [[A_ADDR_0]])
+; CHECK-NEXT: [[TMP:%.*]] = load i32, ptr [[A_ADDR_0]], align 4
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_0]], [[TMP]]
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_COND_CLEANUP:%.*]]
; CHECK: for.cond.cleanup:
; CHECK: for.body:
; CHECK-NEXT: br label [[FOR_INC]]
; CHECK: for.inc:
-; CHECK-NEXT: [[INCDEC_PTR]] = getelementptr inbounds i32, i32* [[A_ADDR_0]], i64 -1
+; CHECK-NEXT: [[INCDEC_PTR]] = getelementptr inbounds i32, ptr [[A_ADDR_0]], i64 -1
; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_0]], 1
; CHECK-NEXT: br label [[FOR_COND]]
; CHECK: for.end:
for.cond: ; preds = %for.inc, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
- %a.addr.0 = phi i32* [ %a, %entry ], [ %incdec.ptr, %for.inc ]
- call void @deref_phi_user(i32* %a.addr.0)
- %tmp = load i32, i32* %a.addr.0, align 4
+ %a.addr.0 = phi ptr [ %a, %entry ], [ %incdec.ptr, %for.inc ]
+ call void @deref_phi_user(ptr %a.addr.0)
+ %tmp = load i32, ptr %a.addr.0, align 4
%cmp = icmp slt i32 %i.0, %tmp
br i1 %cmp, label %for.body, label %for.cond.cleanup
br label %for.inc
for.inc: ; preds = %for.body
- %incdec.ptr = getelementptr inbounds i32, i32* %a.addr.0, i64 -1
+ %incdec.ptr = getelementptr inbounds i32, ptr %a.addr.0, i64 -1
%inc = add nuw nsw i32 %i.0, 1
br label %for.cond
; TEST 6
; loop in which dereferenceabily "shrinks"
-define void @deref_phi_shrinking(i32* dereferenceable(4000) %a) {
+define void @deref_phi_shrinking(ptr dereferenceable(4000) %a) {
; CHECK-LABEL: define {{[^@]+}}@deref_phi_shrinking
-; CHECK-SAME: (i32* nonnull dereferenceable(4000) [[A:%.*]]) {
+; CHECK-SAME: (ptr nonnull dereferenceable(4000) [[A:%.*]]) {
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[FOR_COND:%.*]]
; CHECK: for.cond:
; CHECK-NEXT: [[I_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[FOR_INC:%.*]] ]
-; CHECK-NEXT: [[A_ADDR_0:%.*]] = phi i32* [ [[A]], [[ENTRY]] ], [ [[INCDEC_PTR:%.*]], [[FOR_INC]] ]
-; CHECK-NEXT: call void @deref_phi_user(i32* nonnull [[A_ADDR_0]])
-; CHECK-NEXT: [[TMP:%.*]] = load i32, i32* [[A_ADDR_0]], align 4
+; CHECK-NEXT: [[A_ADDR_0:%.*]] = phi ptr [ [[A]], [[ENTRY]] ], [ [[INCDEC_PTR:%.*]], [[FOR_INC]] ]
+; CHECK-NEXT: call void @deref_phi_user(ptr nonnull [[A_ADDR_0]])
+; CHECK-NEXT: [[TMP:%.*]] = load i32, ptr [[A_ADDR_0]], align 4
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_0]], [[TMP]]
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_COND_CLEANUP:%.*]]
; CHECK: for.cond.cleanup:
; CHECK: for.body:
; CHECK-NEXT: br label [[FOR_INC]]
; CHECK: for.inc:
-; CHECK-NEXT: [[INCDEC_PTR]] = getelementptr inbounds i32, i32* [[A_ADDR_0]], i64 1
+; CHECK-NEXT: [[INCDEC_PTR]] = getelementptr inbounds i32, ptr [[A_ADDR_0]], i64 1
; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_0]], 1
; CHECK-NEXT: br label [[FOR_COND]]
; CHECK: for.end:
for.cond: ; preds = %for.inc, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
- %a.addr.0 = phi i32* [ %a, %entry ], [ %incdec.ptr, %for.inc ]
- call void @deref_phi_user(i32* %a.addr.0)
- %tmp = load i32, i32* %a.addr.0, align 4
+ %a.addr.0 = phi ptr [ %a, %entry ], [ %incdec.ptr, %for.inc ]
+ call void @deref_phi_user(ptr %a.addr.0)
+ %tmp = load i32, ptr %a.addr.0, align 4
%cmp = icmp slt i32 %i.0, %tmp
br i1 %cmp, label %for.body, label %for.cond.cleanup
br label %for.inc
for.inc: ; preds = %for.body
- %incdec.ptr = getelementptr inbounds i32, i32* %a.addr.0, i64 1
+ %incdec.ptr = getelementptr inbounds i32, ptr %a.addr.0, i64 1
%inc = add nuw nsw i32 %i.0, 1
br label %for.cond
; TEST 7
; share known infomation in must-be-executed-context
-declare i32* @unkown_ptr() willreturn nounwind
-declare i32 @unkown_f(i32*) willreturn nounwind
-define i32* @f7_0(i32* %ptr) {
+declare ptr @unkown_ptr() willreturn nounwind
+declare i32 @unkown_f(ptr) willreturn nounwind
+define ptr @f7_0(ptr %ptr) {
; CHECK: Function Attrs: nounwind willreturn
; CHECK-LABEL: define {{[^@]+}}@f7_0
-; CHECK-SAME: (i32* noundef nonnull returned dereferenceable(8) [[PTR:%.*]]) #[[ATTR1:[0-9]+]] {
-; CHECK-NEXT: [[T:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull dereferenceable(8) [[PTR]]) #[[ATTR1]]
-; CHECK-NEXT: ret i32* [[PTR]]
+; CHECK-SAME: (ptr noundef nonnull returned dereferenceable(8) [[PTR:%.*]]) #[[ATTR1:[0-9]+]] {
+; CHECK-NEXT: [[T:%.*]] = tail call i32 @unkown_f(ptr noundef nonnull dereferenceable(8) [[PTR]]) #[[ATTR1]]
+; CHECK-NEXT: ret ptr [[PTR]]
;
- %T = tail call i32 @unkown_f(i32* dereferenceable(8) %ptr)
- ret i32* %ptr
+ %T = tail call i32 @unkown_f(ptr dereferenceable(8) %ptr)
+ ret ptr %ptr
}
-define void @f7_1(i32* %ptr, i1 %c) {
+define void @f7_1(ptr %ptr, i1 %c) {
; CHECK: Function Attrs: nounwind willreturn
; CHECK-LABEL: define {{[^@]+}}@f7_1
-; CHECK-SAME: (i32* noundef nonnull align 4 dereferenceable(4) [[PTR:%.*]], i1 noundef [[C:%.*]]) #[[ATTR1]] {
-; CHECK-NEXT: [[A:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(4) [[PTR]]) #[[ATTR1]]
-; CHECK-NEXT: [[PTR_0:%.*]] = load i32, i32* [[PTR]], align 4
-; CHECK-NEXT: [[B:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(4) [[PTR]]) #[[ATTR1]]
+; CHECK-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[PTR:%.*]], i1 noundef [[C:%.*]]) #[[ATTR1]] {
+; CHECK-NEXT: [[A:%.*]] = tail call i32 @unkown_f(ptr noundef nonnull align 4 dereferenceable(4) [[PTR]]) #[[ATTR1]]
+; CHECK-NEXT: [[PTR_0:%.*]] = load i32, ptr [[PTR]], align 4
+; CHECK-NEXT: [[B:%.*]] = tail call i32 @unkown_f(ptr noundef nonnull align 4 dereferenceable(4) [[PTR]]) #[[ATTR1]]
; CHECK-NEXT: br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
; CHECK: if.true:
-; CHECK-NEXT: [[C:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(8) [[PTR]]) #[[ATTR1]]
-; CHECK-NEXT: [[D:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(8) [[PTR]]) #[[ATTR1]]
-; CHECK-NEXT: [[E:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(8) [[PTR]]) #[[ATTR1]]
+; CHECK-NEXT: [[C:%.*]] = tail call i32 @unkown_f(ptr noundef nonnull align 4 dereferenceable(8) [[PTR]]) #[[ATTR1]]
+; CHECK-NEXT: [[D:%.*]] = tail call i32 @unkown_f(ptr noundef nonnull align 4 dereferenceable(8) [[PTR]]) #[[ATTR1]]
+; CHECK-NEXT: [[E:%.*]] = tail call i32 @unkown_f(ptr noundef nonnull align 4 dereferenceable(8) [[PTR]]) #[[ATTR1]]
; CHECK-NEXT: ret void
; CHECK: if.false:
; CHECK-NEXT: ret void
;
- %A = tail call i32 @unkown_f(i32* %ptr)
- %ptr.0 = load i32, i32* %ptr
+ %A = tail call i32 @unkown_f(ptr %ptr)
+ %ptr.0 = load i32, ptr %ptr
; deref 4 hold
-; FIXME: this should be %B = tail call i32 @unkown_f(i32* nonnull dereferenceable(4) %ptr)
- %B = tail call i32 @unkown_f(i32* dereferenceable(1) %ptr)
+; FIXME: this should be %B = tail call i32 @unkown_f(ptr nonnull dereferenceable(4) %ptr)
+ %B = tail call i32 @unkown_f(ptr dereferenceable(1) %ptr)
br i1%c, label %if.true, label %if.false
if.true:
- %C = tail call i32 @unkown_f(i32* %ptr)
- %D = tail call i32 @unkown_f(i32* dereferenceable(8) %ptr)
- %E = tail call i32 @unkown_f(i32* %ptr)
+ %C = tail call i32 @unkown_f(ptr %ptr)
+ %D = tail call i32 @unkown_f(ptr dereferenceable(8) %ptr)
+ %E = tail call i32 @unkown_f(ptr %ptr)
ret void
if.false:
ret void
; CHECK: Function Attrs: nounwind willreturn
; CHECK-LABEL: define {{[^@]+}}@f7_2
; CHECK-SAME: (i1 noundef [[C:%.*]]) #[[ATTR1]] {
-; CHECK-NEXT: [[PTR:%.*]] = tail call nonnull align 4 dereferenceable(4) i32* @unkown_ptr() #[[ATTR1]]
-; CHECK-NEXT: [[A:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(4) [[PTR]]) #[[ATTR1]]
-; CHECK-NEXT: [[ARG_A_0:%.*]] = load i32, i32* [[PTR]], align 4
-; CHECK-NEXT: [[B:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(4) [[PTR]]) #[[ATTR1]]
+; CHECK-NEXT: [[PTR:%.*]] = tail call nonnull align 4 dereferenceable(4) ptr @unkown_ptr() #[[ATTR1]]
+; CHECK-NEXT: [[A:%.*]] = tail call i32 @unkown_f(ptr noundef nonnull align 4 dereferenceable(4) [[PTR]]) #[[ATTR1]]
+; CHECK-NEXT: [[ARG_A_0:%.*]] = load i32, ptr [[PTR]], align 4
+; CHECK-NEXT: [[B:%.*]] = tail call i32 @unkown_f(ptr noundef nonnull align 4 dereferenceable(4) [[PTR]]) #[[ATTR1]]
; CHECK-NEXT: br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
; CHECK: if.true:
-; CHECK-NEXT: [[C:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(8) [[PTR]]) #[[ATTR1]]
-; CHECK-NEXT: [[D:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(8) [[PTR]]) #[[ATTR1]]
-; CHECK-NEXT: [[E:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(8) [[PTR]]) #[[ATTR1]]
+; CHECK-NEXT: [[C:%.*]] = tail call i32 @unkown_f(ptr noundef nonnull align 4 dereferenceable(8) [[PTR]]) #[[ATTR1]]
+; CHECK-NEXT: [[D:%.*]] = tail call i32 @unkown_f(ptr noundef nonnull align 4 dereferenceable(8) [[PTR]]) #[[ATTR1]]
+; CHECK-NEXT: [[E:%.*]] = tail call i32 @unkown_f(ptr noundef nonnull align 4 dereferenceable(8) [[PTR]]) #[[ATTR1]]
; CHECK-NEXT: ret void
; CHECK: if.false:
; CHECK-NEXT: ret void
;
- %ptr = tail call i32* @unkown_ptr()
- %A = tail call i32 @unkown_f(i32* %ptr)
- %arg_a.0 = load i32, i32* %ptr
+ %ptr = tail call ptr @unkown_ptr()
+ %A = tail call i32 @unkown_f(ptr %ptr)
+ %arg_a.0 = load i32, ptr %ptr
; deref 4 hold
- %B = tail call i32 @unkown_f(i32* dereferenceable(1) %ptr)
+ %B = tail call i32 @unkown_f(ptr dereferenceable(1) %ptr)
br i1%c, label %if.true, label %if.false
if.true:
- %C = tail call i32 @unkown_f(i32* %ptr)
- %D = tail call i32 @unkown_f(i32* dereferenceable(8) %ptr)
- %E = tail call i32 @unkown_f(i32* %ptr)
+ %C = tail call i32 @unkown_f(ptr %ptr)
+ %D = tail call i32 @unkown_f(ptr dereferenceable(8) %ptr)
+ %E = tail call i32 @unkown_f(ptr %ptr)
ret void
if.false:
ret void
}
-define i32* @f7_3() {
+define ptr @f7_3() {
; CHECK: Function Attrs: nounwind willreturn
; CHECK-LABEL: define {{[^@]+}}@f7_3
; CHECK-SAME: () #[[ATTR1]] {
-; CHECK-NEXT: [[PTR:%.*]] = tail call noundef nonnull align 16 dereferenceable(4) i32* @unkown_ptr() #[[ATTR1]]
-; CHECK-NEXT: store i32 10, i32* [[PTR]], align 16
-; CHECK-NEXT: ret i32* [[PTR]]
+; CHECK-NEXT: [[PTR:%.*]] = tail call noundef nonnull align 16 dereferenceable(4) ptr @unkown_ptr() #[[ATTR1]]
+; CHECK-NEXT: store i32 10, ptr [[PTR]], align 16
+; CHECK-NEXT: ret ptr [[PTR]]
;
- %ptr = tail call i32* @unkown_ptr()
- store i32 10, i32* %ptr, align 16
- ret i32* %ptr
+ %ptr = tail call ptr @unkown_ptr()
+ store i32 10, ptr %ptr, align 16
+ ret ptr %ptr
}
; FIXME: This should have a return dereferenceable(8) but we need to make sure it will work in loops as well.
-define i32* @test_for_minus_index(i32* %p) {
+define ptr @test_for_minus_index(ptr %p) {
; CHECK: Function Attrs: nofree norecurse nosync nounwind willreturn memory(argmem: write)
; CHECK-LABEL: define {{[^@]+}}@test_for_minus_index
-; CHECK-SAME: (i32* nofree nonnull writeonly align 4 "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR2:[0-9]+]] {
-; CHECK-NEXT: [[Q:%.*]] = getelementptr inbounds i32, i32* [[P]], i32 -2
-; CHECK-NEXT: store i32 1, i32* [[Q]], align 4
-; CHECK-NEXT: ret i32* [[Q]]
-;
- %q = getelementptr inbounds i32, i32* %p, i32 -2
- store i32 1, i32* %q
- ret i32* %q
+; CHECK-SAME: (ptr nofree nonnull writeonly align 4 "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR2:[0-9]+]] {
+; CHECK-NEXT: [[Q:%.*]] = getelementptr inbounds i32, ptr [[P]], i32 -2
+; CHECK-NEXT: store i32 1, ptr [[Q]], align 4
+; CHECK-NEXT: ret ptr [[Q]]
+;
+ %q = getelementptr inbounds i32, ptr %p, i32 -2
+ store i32 1, ptr %q
+ ret ptr %q
}
-define void @deref_or_null_and_nonnull(i32* dereferenceable_or_null(100) %0) {
+define void @deref_or_null_and_nonnull(ptr dereferenceable_or_null(100) %0) {
; CHECK: Function Attrs: nofree norecurse nosync nounwind willreturn memory(argmem: write)
; CHECK-LABEL: define {{[^@]+}}@deref_or_null_and_nonnull
-; CHECK-SAME: (i32* nocapture nofree noundef nonnull writeonly align 4 dereferenceable(100) [[TMP0:%.*]]) #[[ATTR2]] {
-; CHECK-NEXT: store i32 1, i32* [[TMP0]], align 4
+; CHECK-SAME: (ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(100) [[TMP0:%.*]]) #[[ATTR2]] {
+; CHECK-NEXT: store i32 1, ptr [[TMP0]], align 4
; CHECK-NEXT: ret void
;
- store i32 1, i32* %0
+ store i32 1, ptr %0
ret void
}
; }
; FIXME: %ptr should be dereferenceable(31)
-define void @test8(i8* %ptr) #0 {
+define void @test8(ptr %ptr) #0 {
; CHECK: Function Attrs: nofree norecurse nosync nounwind willreturn memory(argmem: write)
; CHECK-LABEL: define {{[^@]+}}@test8
-; CHECK-SAME: (i8* nocapture nofree nonnull writeonly dereferenceable(21) [[PTR:%.*]]) #[[ATTR2]] {
+; CHECK-SAME: (ptr nocapture nofree nonnull writeonly dereferenceable(21) [[PTR:%.*]]) #[[ATTR2]] {
; CHECK-NEXT: br label [[TMP1:%.*]]
; CHECK: 1:
; CHECK-NEXT: [[I_0:%.*]] = phi i32 [ 20, [[TMP0:%.*]] ], [ [[TMP4:%.*]], [[TMP5:%.*]] ]
; CHECK-NEXT: [[TMP2:%.*]] = sext i32 [[I_0]] to i64
-; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i64 [[TMP2]]
-; CHECK-NEXT: store i8 32, i8* [[TMP3]], align 1
+; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[PTR]], i64 [[TMP2]]
+; CHECK-NEXT: store i8 32, ptr [[TMP3]], align 1
; CHECK-NEXT: [[TMP4]] = add nsw i32 [[I_0]], 1
; CHECK-NEXT: br label [[TMP5]]
; CHECK: 5:
1: ; preds = %5, %0
%i.0 = phi i32 [ 20, %0 ], [ %4, %5 ]
%2 = sext i32 %i.0 to i64
- %3 = getelementptr inbounds i8, i8* %ptr, i64 %2
- store i8 32, i8* %3, align 1
+ %3 = getelementptr inbounds i8, ptr %ptr, i64 %2
+ store i8 32, ptr %3, align 1
%4 = add nsw i32 %i.0, 1
br label %5
5: ; preds = %1
}
; 8.2 (negative case)
-define void @test8_neg(i32 %i, i8* %ptr) #0 {
+define void @test8_neg(i32 %i, ptr %ptr) #0 {
; CHECK: Function Attrs: nofree norecurse nosync nounwind willreturn memory(argmem: write)
; CHECK-LABEL: define {{[^@]+}}@test8_neg
-; CHECK-SAME: (i32 [[I:%.*]], i8* nocapture nofree nonnull writeonly [[PTR:%.*]]) #[[ATTR2]] {
+; CHECK-SAME: (i32 [[I:%.*]], ptr nocapture nofree nonnull writeonly [[PTR:%.*]]) #[[ATTR2]] {
; CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[I]] to i64
-; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i64 [[TMP1]]
-; CHECK-NEXT: store i8 65, i8* [[TMP2]], align 1
+; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i8, ptr [[PTR]], i64 [[TMP1]]
+; CHECK-NEXT: store i8 65, ptr [[TMP2]], align 1
; CHECK-NEXT: ret void
;
%1 = sext i32 %i to i64
- %2 = getelementptr inbounds i8, i8* %ptr, i64 %1
- store i8 65, i8* %2, align 1
+ %2 = getelementptr inbounds i8, ptr %ptr, i64 %1
+ store i8 65, ptr %2, align 1
ret void
}
; }
; NOTE: %p should not be dereferenceable
-define internal void @fill_range_not_inbounds(i32* %p, i64 %start){
+define internal void @fill_range_not_inbounds(ptr %p, i64 %start){
; CHECK: Function Attrs: nofree norecurse nosync nounwind willreturn memory(argmem: write)
; CHECK-LABEL: define {{[^@]+}}@fill_range_not_inbounds
-; CHECK-SAME: (i32* nocapture nofree writeonly [[P:%.*]], i64 [[START:%.*]]) #[[ATTR2]] {
+; CHECK-SAME: (ptr nocapture nofree writeonly [[P:%.*]], i64 [[START:%.*]]) #[[ATTR2]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP0:%.*]] = add nsw i64 [[START]], 9
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
; CHECK: for.body:
; CHECK-NEXT: [[I_06:%.*]] = phi i64 [ [[START]], [[ENTRY:%.*]] ], [ [[INC:%.*]], [[FOR_BODY]] ]
; CHECK-NEXT: [[CONV:%.*]] = trunc i64 [[I_06]] to i32
-; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr i32, i32* [[P]], i64 [[I_06]]
-; CHECK-NEXT: store i32 [[CONV]], i32* [[ARRAYIDX]], align 4
+; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr i32, ptr [[P]], i64 [[I_06]]
+; CHECK-NEXT: store i32 [[CONV]], ptr [[ARRAYIDX]], align 4
; CHECK-NEXT: [[INC]] = add nsw i64 [[I_06]], 1
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[I_06]], [[TMP0]]
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_COND_CLEANUP:%.*]]
for.body: ; preds = %entry, %for.body
%i.06 = phi i64 [ %start, %entry ], [ %inc, %for.body ]
%conv = trunc i64 %i.06 to i32
- %arrayidx = getelementptr i32, i32* %p, i64 %i.06
- store i32 %conv, i32* %arrayidx, align 4
+ %arrayidx = getelementptr i32, ptr %p, i64 %i.06
+ store i32 %conv, ptr %arrayidx, align 4
%inc = add nsw i64 %i.06, 1
%cmp = icmp slt i64 %i.06, %0
br i1 %cmp, label %for.body, label %for.cond.cleanup
}
; FIXME: %p should be dereferenceable(40)
-define internal void @fill_range_inbounds(i32* %p, i64 %start){
+define internal void @fill_range_inbounds(ptr %p, i64 %start){
; CHECK: Function Attrs: nofree norecurse nosync nounwind willreturn memory(argmem: write)
; CHECK-LABEL: define {{[^@]+}}@fill_range_inbounds
-; CHECK-SAME: (i32* nocapture nofree writeonly [[P:%.*]], i64 [[START:%.*]]) #[[ATTR2]] {
+; CHECK-SAME: (ptr nocapture nofree writeonly [[P:%.*]], i64 [[START:%.*]]) #[[ATTR2]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP0:%.*]] = add nsw i64 [[START]], 9
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
; CHECK: for.body:
; CHECK-NEXT: [[I_06:%.*]] = phi i64 [ [[START]], [[ENTRY:%.*]] ], [ [[INC:%.*]], [[FOR_BODY]] ]
; CHECK-NEXT: [[CONV:%.*]] = trunc i64 [[I_06]] to i32
-; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[P]], i64 [[I_06]]
-; CHECK-NEXT: store i32 [[CONV]], i32* [[ARRAYIDX]], align 4
+; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[P]], i64 [[I_06]]
+; CHECK-NEXT: store i32 [[CONV]], ptr [[ARRAYIDX]], align 4
; CHECK-NEXT: [[INC]] = add nsw i64 [[I_06]], 1
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[I_06]], [[TMP0]]
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_COND_CLEANUP:%.*]]
for.body: ; preds = %entry, %for.body
%i.06 = phi i64 [ %start, %entry ], [ %inc, %for.body ]
%conv = trunc i64 %i.06 to i32
- %arrayidx = getelementptr inbounds i32, i32* %p, i64 %i.06
- store i32 %conv, i32* %arrayidx, align 4
+ %arrayidx = getelementptr inbounds i32, ptr %p, i64 %i.06
+ store i32 %conv, ptr %arrayidx, align 4
%inc = add nsw i64 %i.06, 1
%cmp = icmp slt i64 %i.06, %0
br i1 %cmp, label %for.body, label %for.cond.cleanup
}
-define void @call_fill_range(i32* nocapture %p, i64* nocapture readonly %range) {
+define void @call_fill_range(ptr nocapture %p, ptr nocapture readonly %range) {
; TUNIT: Function Attrs: nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
; TUNIT-LABEL: define {{[^@]+}}@call_fill_range
-; TUNIT-SAME: (i32* nocapture nofree writeonly [[P:%.*]], i64* nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[RANGE:%.*]]) #[[ATTR3:[0-9]+]] {
+; TUNIT-SAME: (ptr nocapture nofree writeonly [[P:%.*]], ptr nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[RANGE:%.*]]) #[[ATTR3:[0-9]+]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[TMP0:%.*]] = load i64, i64* [[RANGE]], align 8, !range [[RNG0:![0-9]+]]
-; TUNIT-NEXT: tail call void @fill_range_inbounds(i32* nocapture nofree writeonly [[P]], i64 [[TMP0]]) #[[ATTR6:[0-9]+]]
-; TUNIT-NEXT: tail call void @fill_range_not_inbounds(i32* nocapture nofree writeonly [[P]], i64 [[TMP0]]) #[[ATTR6]]
+; TUNIT-NEXT: [[TMP0:%.*]] = load i64, ptr [[RANGE]], align 8, !range [[RNG0:![0-9]+]]
+; TUNIT-NEXT: tail call void @fill_range_inbounds(ptr nocapture nofree writeonly [[P]], i64 [[TMP0]]) #[[ATTR6:[0-9]+]]
+; TUNIT-NEXT: tail call void @fill_range_not_inbounds(ptr nocapture nofree writeonly [[P]], i64 [[TMP0]]) #[[ATTR6]]
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: nofree nosync nounwind willreturn memory(argmem: readwrite)
; CGSCC-LABEL: define {{[^@]+}}@call_fill_range
-; CGSCC-SAME: (i32* nocapture nofree writeonly [[P:%.*]], i64* nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[RANGE:%.*]]) #[[ATTR3:[0-9]+]] {
+; CGSCC-SAME: (ptr nocapture nofree writeonly [[P:%.*]], ptr nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[RANGE:%.*]]) #[[ATTR3:[0-9]+]] {
; CGSCC-NEXT: entry:
-; CGSCC-NEXT: [[TMP0:%.*]] = load i64, i64* [[RANGE]], align 8, !range [[RNG0:![0-9]+]]
-; CGSCC-NEXT: tail call void @fill_range_inbounds(i32* nocapture nofree writeonly [[P]], i64 [[TMP0]]) #[[ATTR1]]
-; CGSCC-NEXT: tail call void @fill_range_not_inbounds(i32* nocapture nofree writeonly [[P]], i64 [[TMP0]]) #[[ATTR1]]
+; CGSCC-NEXT: [[TMP0:%.*]] = load i64, ptr [[RANGE]], align 8, !range [[RNG0:![0-9]+]]
+; CGSCC-NEXT: tail call void @fill_range_inbounds(ptr nocapture nofree writeonly [[P]], i64 [[TMP0]]) #[[ATTR1]]
+; CGSCC-NEXT: tail call void @fill_range_not_inbounds(ptr nocapture nofree writeonly [[P]], i64 [[TMP0]]) #[[ATTR1]]
; CGSCC-NEXT: ret void
;
entry:
- %0 = load i64, i64* %range, align 8, !range !0
- tail call void @fill_range_inbounds(i32* %p, i64 %0)
- tail call void @fill_range_not_inbounds(i32* %p, i64 %0)
+ %0 = load i64, ptr %range, align 8, !range !0
+ tail call void @fill_range_inbounds(ptr %p, i64 %0)
+ tail call void @fill_range_not_inbounds(ptr %p, i64 %0)
ret void
}
declare void @use0() willreturn nounwind
-declare void @use1(i8*) willreturn nounwind
-declare void @use2(i8*, i8*) willreturn nounwind
-declare void @use3(i8*, i8*, i8*) willreturn nounwind
+declare void @use1(ptr) willreturn nounwind
+declare void @use2(ptr, ptr) willreturn nounwind
+declare void @use3(ptr, ptr, ptr) willreturn nounwind
; simple path test
; if(..)
; else
; fun2(dereferenceable(4) %a, %b)
; We can say that %a is dereferenceable(4) but %b is not.
-define void @simple-path(i8* %a, i8 * %b, i8 %c) {
+define void @simple-path(ptr %a, ptr %b, i8 %c) {
; CHECK: Function Attrs: nounwind willreturn
; CHECK-LABEL: define {{[^@]+}}@simple-path
-; CHECK-SAME: (i8* nonnull dereferenceable(4) [[A:%.*]], i8* [[B:%.*]], i8 [[C:%.*]]) #[[ATTR1]] {
+; CHECK-SAME: (ptr nonnull dereferenceable(4) [[A:%.*]], ptr [[B:%.*]], i8 [[C:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[C]], 0
; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
; CHECK: if.then:
-; CHECK-NEXT: tail call void @use2(i8* nonnull dereferenceable(8) [[A]], i8* nonnull dereferenceable(8) [[B]]) #[[ATTR1]]
+; CHECK-NEXT: tail call void @use2(ptr nonnull dereferenceable(8) [[A]], ptr nonnull dereferenceable(8) [[B]]) #[[ATTR1]]
; CHECK-NEXT: ret void
; CHECK: if.else:
-; CHECK-NEXT: tail call void @use2(i8* nonnull dereferenceable(4) [[A]], i8* [[B]]) #[[ATTR1]]
+; CHECK-NEXT: tail call void @use2(ptr nonnull dereferenceable(4) [[A]], ptr [[B]]) #[[ATTR1]]
; CHECK-NEXT: ret void
;
%cmp = icmp eq i8 %c, 0
br i1 %cmp, label %if.then, label %if.else
if.then:
- tail call void @use2(i8* dereferenceable(8) %a, i8* dereferenceable(8) %b)
+ tail call void @use2(ptr dereferenceable(8) %a, ptr dereferenceable(8) %b)
ret void
if.else:
- tail call void @use2(i8* dereferenceable(4) %a, i8* %b)
+ tail call void @use2(ptr dereferenceable(4) %a, ptr %b)
ret void
}
; fun1(dereferenceable(8) %a)
; }
; %a is dereferenceable(12)
-define void @complex-path(i8* %a, i8* %b, i8 %c) {
+define void @complex-path(ptr %a, ptr %b, i8 %c) {
; CHECK: Function Attrs: nounwind willreturn
; CHECK-LABEL: define {{[^@]+}}@complex-path
-; CHECK-SAME: (i8* noundef nonnull dereferenceable(12) [[A:%.*]], i8* nocapture nofree readnone [[B:%.*]], i8 [[C:%.*]]) #[[ATTR1]] {
+; CHECK-SAME: (ptr noundef nonnull dereferenceable(12) [[A:%.*]], ptr nocapture nofree readnone [[B:%.*]], i8 [[C:%.*]]) #[[ATTR1]] {
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[C]], 0
-; CHECK-NEXT: tail call void @use1(i8* noundef nonnull dereferenceable(12) [[A]]) #[[ATTR1]]
+; CHECK-NEXT: tail call void @use1(ptr noundef nonnull dereferenceable(12) [[A]]) #[[ATTR1]]
; CHECK-NEXT: br i1 [[CMP]], label [[CONT_THEN:%.*]], label [[CONT_ELSE:%.*]]
; CHECK: cont.then:
-; CHECK-NEXT: tail call void @use1(i8* noundef nonnull dereferenceable(12) [[A]]) #[[ATTR1]]
+; CHECK-NEXT: tail call void @use1(ptr noundef nonnull dereferenceable(12) [[A]]) #[[ATTR1]]
; CHECK-NEXT: br label [[CONT2:%.*]]
; CHECK: cont.else:
-; CHECK-NEXT: tail call void @use1(i8* noundef nonnull dereferenceable(16) [[A]]) #[[ATTR1]]
+; CHECK-NEXT: tail call void @use1(ptr noundef nonnull dereferenceable(16) [[A]]) #[[ATTR1]]
; CHECK-NEXT: br label [[CONT2]]
; CHECK: cont2:
-; CHECK-NEXT: tail call void @use1(i8* noundef nonnull dereferenceable(12) [[A]]) #[[ATTR1]]
+; CHECK-NEXT: tail call void @use1(ptr noundef nonnull dereferenceable(12) [[A]]) #[[ATTR1]]
; CHECK-NEXT: ret void
;
%cmp = icmp eq i8 %c, 0
- tail call void @use1(i8* dereferenceable(4) %a)
+ tail call void @use1(ptr dereferenceable(4) %a)
br i1 %cmp, label %cont.then, label %cont.else
cont.then:
- tail call void @use1(i8* dereferenceable(12) %a)
+ tail call void @use1(ptr dereferenceable(12) %a)
br label %cont2
cont.else:
- tail call void @use1(i8* dereferenceable(16) %a)
+ tail call void @use1(ptr dereferenceable(16) %a)
br label %cont2
cont2:
- tail call void @use1(i8* dereferenceable(8) %a)
+ tail call void @use1(ptr dereferenceable(8) %a)
ret void
}
; }
;
; FIXME: %ptr should be dereferenceable(4)
-define dso_local void @rec-branch-1(i32 %a, i32 %b, i32 %c, i32* %ptr) {
+define dso_local void @rec-branch-1(i32 %a, i32 %b, i32 %c, ptr %ptr) {
; CHECK: Function Attrs: nofree norecurse nosync nounwind willreturn memory(argmem: write)
; CHECK-LABEL: define {{[^@]+}}@rec-branch-1
-; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]], i32 [[C:%.*]], i32* nocapture nofree writeonly [[PTR:%.*]]) #[[ATTR2]] {
+; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]], i32 [[C:%.*]], ptr nocapture nofree writeonly [[PTR:%.*]]) #[[ATTR2]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[A]], 0
; CHECK-NEXT: br i1 [[TOBOOL]], label [[IF_ELSE3:%.*]], label [[IF_THEN:%.*]]
; CHECK-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[B]], 0
; CHECK-NEXT: br i1 [[TOBOOL1]], label [[IF_ELSE:%.*]], label [[IF_THEN2:%.*]]
; CHECK: if.then2:
-; CHECK-NEXT: store i32 1, i32* [[PTR]], align 4
+; CHECK-NEXT: store i32 1, ptr [[PTR]], align 4
; CHECK-NEXT: br label [[IF_END8:%.*]]
; CHECK: if.else:
-; CHECK-NEXT: store i32 2, i32* [[PTR]], align 4
+; CHECK-NEXT: store i32 2, ptr [[PTR]], align 4
; CHECK-NEXT: br label [[IF_END8]]
; CHECK: if.else3:
; CHECK-NEXT: [[TOBOOL4:%.*]] = icmp eq i32 [[C]], 0
; CHECK-NEXT: br i1 [[TOBOOL4]], label [[IF_ELSE6:%.*]], label [[IF_THEN5:%.*]]
; CHECK: if.then5:
-; CHECK-NEXT: store i32 3, i32* [[PTR]], align 4
+; CHECK-NEXT: store i32 3, ptr [[PTR]], align 4
; CHECK-NEXT: br label [[IF_END8]]
; CHECK: if.else6:
-; CHECK-NEXT: store i32 4, i32* [[PTR]], align 4
+; CHECK-NEXT: store i32 4, ptr [[PTR]], align 4
; CHECK-NEXT: br label [[IF_END8]]
; CHECK: if.end8:
; CHECK-NEXT: ret void
br i1 %tobool1, label %if.else, label %if.then2
if.then2: ; preds = %if.then
- store i32 1, i32* %ptr, align 4
+ store i32 1, ptr %ptr, align 4
br label %if.end8
if.else: ; preds = %if.then
- store i32 2, i32* %ptr, align 4
+ store i32 2, ptr %ptr, align 4
br label %if.end8
if.else3: ; preds = %entry
br i1 %tobool4, label %if.else6, label %if.then5
if.then5: ; preds = %if.else3
- store i32 3, i32* %ptr, align 4
+ store i32 3, ptr %ptr, align 4
br label %if.end8
if.else6: ; preds = %if.else3
- store i32 4, i32* %ptr, align 4
+ store i32 4, ptr %ptr, align 4
br label %if.end8
if.end8: ; preds = %if.then5, %if.else6, %if.then2, %if.else
; }
; }
; FIXME: %ptr should be dereferenceable(4)
-define dso_local void @rec-branch-2(i32 %a, i32 %b, i32 %c, i32* %ptr) {
+define dso_local void @rec-branch-2(i32 %a, i32 %b, i32 %c, ptr %ptr) {
; TUNIT: Function Attrs: nofree nosync nounwind memory(argmem: write)
; TUNIT-LABEL: define {{[^@]+}}@rec-branch-2
-; TUNIT-SAME: (i32 [[A:%.*]], i32 [[B:%.*]], i32 [[C:%.*]], i32* nocapture nofree writeonly [[PTR:%.*]]) #[[ATTR4:[0-9]+]] {
+; TUNIT-SAME: (i32 [[A:%.*]], i32 [[B:%.*]], i32 [[C:%.*]], ptr nocapture nofree writeonly [[PTR:%.*]]) #[[ATTR4:[0-9]+]] {
; TUNIT-NEXT: entry:
; TUNIT-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[A]], 0
; TUNIT-NEXT: br i1 [[TOBOOL]], label [[IF_ELSE3:%.*]], label [[IF_THEN:%.*]]
; TUNIT-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[B]], 0
; TUNIT-NEXT: br i1 [[TOBOOL1]], label [[IF_ELSE:%.*]], label [[IF_THEN2:%.*]]
; TUNIT: if.then2:
-; TUNIT-NEXT: store i32 1, i32* [[PTR]], align 4
+; TUNIT-NEXT: store i32 1, ptr [[PTR]], align 4
; TUNIT-NEXT: br label [[IF_END8:%.*]]
; TUNIT: if.else:
-; TUNIT-NEXT: store i32 2, i32* [[PTR]], align 4
+; TUNIT-NEXT: store i32 2, ptr [[PTR]], align 4
; TUNIT-NEXT: br label [[IF_END8]]
; TUNIT: if.else3:
; TUNIT-NEXT: [[TOBOOL4:%.*]] = icmp eq i32 [[C]], 0
; TUNIT-NEXT: br i1 [[TOBOOL4]], label [[IF_ELSE6:%.*]], label [[IF_THEN5:%.*]]
; TUNIT: if.then5:
-; TUNIT-NEXT: store i32 3, i32* [[PTR]], align 4
+; TUNIT-NEXT: store i32 3, ptr [[PTR]], align 4
; TUNIT-NEXT: br label [[IF_END8]]
; TUNIT: if.else6:
-; TUNIT-NEXT: tail call void @rec-branch-2(i32 noundef 1, i32 noundef 1, i32 noundef 1, i32* nocapture nofree writeonly [[PTR]]) #[[ATTR7:[0-9]+]]
+; TUNIT-NEXT: tail call void @rec-branch-2(i32 noundef 1, i32 noundef 1, i32 noundef 1, ptr nocapture nofree writeonly [[PTR]]) #[[ATTR7:[0-9]+]]
; TUNIT-NEXT: br label [[IF_END8]]
; TUNIT: if.end8:
; TUNIT-NEXT: ret void
;
; CGSCC: Function Attrs: nofree nosync nounwind memory(argmem: write)
; CGSCC-LABEL: define {{[^@]+}}@rec-branch-2
-; CGSCC-SAME: (i32 [[A:%.*]], i32 [[B:%.*]], i32 [[C:%.*]], i32* nocapture nofree writeonly [[PTR:%.*]]) #[[ATTR4:[0-9]+]] {
+; CGSCC-SAME: (i32 [[A:%.*]], i32 [[B:%.*]], i32 [[C:%.*]], ptr nocapture nofree writeonly [[PTR:%.*]]) #[[ATTR4:[0-9]+]] {
; CGSCC-NEXT: entry:
; CGSCC-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[A]], 0
; CGSCC-NEXT: br i1 [[TOBOOL]], label [[IF_ELSE3:%.*]], label [[IF_THEN:%.*]]
; CGSCC-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[B]], 0
; CGSCC-NEXT: br i1 [[TOBOOL1]], label [[IF_ELSE:%.*]], label [[IF_THEN2:%.*]]
; CGSCC: if.then2:
-; CGSCC-NEXT: store i32 1, i32* [[PTR]], align 4
+; CGSCC-NEXT: store i32 1, ptr [[PTR]], align 4
; CGSCC-NEXT: br label [[IF_END8:%.*]]
; CGSCC: if.else:
-; CGSCC-NEXT: store i32 2, i32* [[PTR]], align 4
+; CGSCC-NEXT: store i32 2, ptr [[PTR]], align 4
; CGSCC-NEXT: br label [[IF_END8]]
; CGSCC: if.else3:
; CGSCC-NEXT: [[TOBOOL4:%.*]] = icmp eq i32 [[C]], 0
; CGSCC-NEXT: br i1 [[TOBOOL4]], label [[IF_ELSE6:%.*]], label [[IF_THEN5:%.*]]
; CGSCC: if.then5:
-; CGSCC-NEXT: store i32 3, i32* [[PTR]], align 4
+; CGSCC-NEXT: store i32 3, ptr [[PTR]], align 4
; CGSCC-NEXT: br label [[IF_END8]]
; CGSCC: if.else6:
-; CGSCC-NEXT: tail call void @rec-branch-2(i32 noundef 1, i32 noundef 1, i32 noundef 1, i32* nocapture nofree writeonly [[PTR]]) #[[ATTR6:[0-9]+]]
+; CGSCC-NEXT: tail call void @rec-branch-2(i32 noundef 1, i32 noundef 1, i32 noundef 1, ptr nocapture nofree writeonly [[PTR]]) #[[ATTR6:[0-9]+]]
; CGSCC-NEXT: br label [[IF_END8]]
; CGSCC: if.end8:
; CGSCC-NEXT: ret void
br i1 %tobool1, label %if.else, label %if.then2
if.then2: ; preds = %if.then
- store i32 1, i32* %ptr, align 4
+ store i32 1, ptr %ptr, align 4
br label %if.end8
if.else: ; preds = %if.then
- store i32 2, i32* %ptr, align 4
+ store i32 2, ptr %ptr, align 4
br label %if.end8
if.else3: ; preds = %entry
br i1 %tobool4, label %if.else6, label %if.then5
if.then5: ; preds = %if.else3
- store i32 3, i32* %ptr, align 4
+ store i32 3, ptr %ptr, align 4
br label %if.end8
if.else6: ; preds = %if.else3
- tail call void @rec-branch-2(i32 1, i32 1, i32 1, i32* %ptr)
+ tail call void @rec-branch-2(i32 1, i32 1, i32 1, ptr %ptr)
br label %if.end8
if.end8: ; preds = %if.then5, %if.else6, %if.then2, %if.else
}
declare void @unknown()
-define void @nonnull_assume_pos(i8* %arg1, i8* %arg2, i8* %arg3, i8* %arg4) {
+define void @nonnull_assume_pos(ptr %arg1, ptr %arg2, ptr %arg3, ptr %arg4) {
; ATTRIBUTOR-LABEL: define {{[^@]+}}@nonnull_assume_pos
-; ATTRIBUTOR-SAME: (i8* nocapture nofree nonnull readnone dereferenceable(101) [[ARG1:%.*]], i8* nocapture nofree readnone dereferenceable_or_null(31) [[ARG2:%.*]], i8* nocapture nofree nonnull readnone [[ARG3:%.*]], i8* nocapture nofree readnone dereferenceable_or_null(42) [[ARG4:%.*]])
-; ATTRIBUTOR-NEXT: call void @llvm.assume(i1 true) #6 [ "nonnull"(i8* undef), "dereferenceable"(i8* undef, i64 1), "dereferenceable"(i8* undef, i64 2), "dereferenceable"(i8* undef, i64 101), "dereferenceable_or_null"(i8* undef, i64 31), "dereferenceable_or_null"(i8* undef, i64 42) ]
+; ATTRIBUTOR-SAME: (ptr nocapture nofree nonnull readnone dereferenceable(101) [[ARG1:%.*]], ptr nocapture nofree readnone dereferenceable_or_null(31) [[ARG2:%.*]], ptr nocapture nofree nonnull readnone [[ARG3:%.*]], ptr nocapture nofree readnone dereferenceable_or_null(42) [[ARG4:%.*]])
+; ATTRIBUTOR-NEXT: call void @llvm.assume(i1 true) #6 [ "nonnull"(ptr undef), "dereferenceable"(ptr undef, i64 1), "dereferenceable"(ptr undef, i64 2), "dereferenceable"(ptr undef, i64 101), "dereferenceable_or_null"(ptr undef, i64 31), "dereferenceable_or_null"(ptr undef, i64 42) ]
; ATTRIBUTOR-NEXT: call void @unknown()
; ATTRIBUTOR-NEXT: ret void
;
; TUNIT-LABEL: define {{[^@]+}}@nonnull_assume_pos
-; TUNIT-SAME: (i8* nocapture nofree nonnull readnone dereferenceable(101) [[ARG1:%.*]], i8* nocapture nofree readnone dereferenceable_or_null(31) [[ARG2:%.*]], i8* nocapture nofree nonnull readnone [[ARG3:%.*]], i8* nocapture nofree readnone dereferenceable_or_null(42) [[ARG4:%.*]]) {
-; TUNIT-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR8:[0-9]+]] [ "nonnull"(i8* [[ARG3]]), "dereferenceable"(i8* [[ARG1]], i64 1), "dereferenceable"(i8* [[ARG1]], i64 2), "dereferenceable"(i8* [[ARG1]], i64 101), "dereferenceable_or_null"(i8* [[ARG2]], i64 31), "dereferenceable_or_null"(i8* [[ARG4]], i64 42) ]
+; TUNIT-SAME: (ptr nocapture nofree nonnull readnone dereferenceable(101) [[ARG1:%.*]], ptr nocapture nofree readnone dereferenceable_or_null(31) [[ARG2:%.*]], ptr nocapture nofree nonnull readnone [[ARG3:%.*]], ptr nocapture nofree readnone dereferenceable_or_null(42) [[ARG4:%.*]]) {
+; TUNIT-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR8:[0-9]+]] [ "nonnull"(ptr [[ARG3]]), "dereferenceable"(ptr [[ARG1]], i64 1), "dereferenceable"(ptr [[ARG1]], i64 2), "dereferenceable"(ptr [[ARG1]], i64 101), "dereferenceable_or_null"(ptr [[ARG2]], i64 31), "dereferenceable_or_null"(ptr [[ARG4]], i64 42) ]
; TUNIT-NEXT: call void @unknown()
; TUNIT-NEXT: ret void
;
; CGSCC-LABEL: define {{[^@]+}}@nonnull_assume_pos
-; CGSCC-SAME: (i8* nocapture nofree nonnull readnone dereferenceable(101) [[ARG1:%.*]], i8* nocapture nofree readnone dereferenceable_or_null(31) [[ARG2:%.*]], i8* nocapture nofree nonnull readnone [[ARG3:%.*]], i8* nocapture nofree readnone dereferenceable_or_null(42) [[ARG4:%.*]]) {
-; CGSCC-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR7:[0-9]+]] [ "nonnull"(i8* [[ARG3]]), "dereferenceable"(i8* [[ARG1]], i64 1), "dereferenceable"(i8* [[ARG1]], i64 2), "dereferenceable"(i8* [[ARG1]], i64 101), "dereferenceable_or_null"(i8* [[ARG2]], i64 31), "dereferenceable_or_null"(i8* [[ARG4]], i64 42) ]
+; CGSCC-SAME: (ptr nocapture nofree nonnull readnone dereferenceable(101) [[ARG1:%.*]], ptr nocapture nofree readnone dereferenceable_or_null(31) [[ARG2:%.*]], ptr nocapture nofree nonnull readnone [[ARG3:%.*]], ptr nocapture nofree readnone dereferenceable_or_null(42) [[ARG4:%.*]]) {
+; CGSCC-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR7:[0-9]+]] [ "nonnull"(ptr [[ARG3]]), "dereferenceable"(ptr [[ARG1]], i64 1), "dereferenceable"(ptr [[ARG1]], i64 2), "dereferenceable"(ptr [[ARG1]], i64 101), "dereferenceable_or_null"(ptr [[ARG2]], i64 31), "dereferenceable_or_null"(ptr [[ARG4]], i64 42) ]
; CGSCC-NEXT: call void @unknown()
; CGSCC-NEXT: ret void
;
- call void @llvm.assume(i1 true) [ "nonnull"(i8* %arg3), "dereferenceable"(i8* %arg1, i64 1), "dereferenceable"(i8* %arg1, i64 2), "dereferenceable"(i8* %arg1, i64 101), "dereferenceable_or_null"(i8* %arg2, i64 31), "dereferenceable_or_null"(i8* %arg4, i64 42)]
+ call void @llvm.assume(i1 true) [ "nonnull"(ptr %arg3), "dereferenceable"(ptr %arg1, i64 1), "dereferenceable"(ptr %arg1, i64 2), "dereferenceable"(ptr %arg1, i64 101), "dereferenceable_or_null"(ptr %arg2, i64 31), "dereferenceable_or_null"(ptr %arg4, i64 42)]
call void @unknown()
ret void
}
-define void @nonnull_assume_neg(i8* %arg1, i8* %arg2, i8* %arg3) {
+define void @nonnull_assume_neg(ptr %arg1, ptr %arg2, ptr %arg3) {
; ATTRIBUTOR-LABEL: define {{[^@]+}}@nonnull_assume_neg
-; ATTRIBUTOR-SAME: (i8* nocapture nofree readnone [[ARG1:%.*]], i8* nocapture nofree readnone [[ARG2:%.*]], i8* nocapture nofree readnone [[ARG3:%.*]])
+; ATTRIBUTOR-SAME: (ptr nocapture nofree readnone [[ARG1:%.*]], ptr nocapture nofree readnone [[ARG2:%.*]], ptr nocapture nofree readnone [[ARG3:%.*]])
; ATTRIBUTOR-NEXT: call void @unknown()
-; ATTRIBUTOR-NEXT: call void @llvm.assume(i1 true) [ "dereferenceable"(i8* undef, i64 101), "dereferenceable"(i8* undef, i64 -2), "dereferenceable_or_null"(i8* undef, i64 31) ]
+; ATTRIBUTOR-NEXT: call void @llvm.assume(i1 true) [ "dereferenceable"(ptr undef, i64 101), "dereferenceable"(ptr undef, i64 -2), "dereferenceable_or_null"(ptr undef, i64 31) ]
; ATTRIBUTOR-NEXT: ret void
;
; CHECK-LABEL: define {{[^@]+}}@nonnull_assume_neg
-; CHECK-SAME: (i8* nocapture nofree readnone [[ARG1:%.*]], i8* nocapture nofree readnone [[ARG2:%.*]], i8* nocapture nofree readnone [[ARG3:%.*]]) {
+; CHECK-SAME: (ptr nocapture nofree readnone [[ARG1:%.*]], ptr nocapture nofree readnone [[ARG2:%.*]], ptr nocapture nofree readnone [[ARG3:%.*]]) {
; CHECK-NEXT: call void @unknown()
-; CHECK-NEXT: call void @llvm.assume(i1 noundef true) [ "dereferenceable"(i8* [[ARG1]], i64 101), "dereferenceable"(i8* [[ARG2]], i64 -2), "dereferenceable_or_null"(i8* [[ARG3]], i64 31) ]
+; CHECK-NEXT: call void @llvm.assume(i1 noundef true) [ "dereferenceable"(ptr [[ARG1]], i64 101), "dereferenceable"(ptr [[ARG2]], i64 -2), "dereferenceable_or_null"(ptr [[ARG3]], i64 31) ]
; CHECK-NEXT: ret void
;
call void @unknown()
- call void @llvm.assume(i1 true) ["dereferenceable"(i8* %arg1, i64 101), "dereferenceable"(i8* %arg2, i64 -2), "dereferenceable_or_null"(i8* %arg3, i64 31)]
+ call void @llvm.assume(i1 true) ["dereferenceable"(ptr %arg1, i64 101), "dereferenceable"(ptr %arg2, i64 -2), "dereferenceable_or_null"(ptr %arg3, i64 31)]
ret void
}
-define void @nonnull_assume_call(i8* %arg1, i8* %arg2, i8* %arg3, i8* %arg4) {
+define void @nonnull_assume_call(ptr %arg1, ptr %arg2, ptr %arg3, ptr %arg4) {
; ATTRIBUTOR-LABEL: define {{[^@]+}}@nonnull_assume_call
-; ATTRIBUTOR-SAME: (i8* [[ARG1:%.*]], i8* [[ARG2:%.*]], i8* [[ARG3:%.*]], i8* [[ARG4:%.*]])
+; ATTRIBUTOR-SAME: (ptr [[ARG1:%.*]], ptr [[ARG2:%.*]], ptr [[ARG3:%.*]], ptr [[ARG4:%.*]])
; ATTRIBUTOR-NEXT: call void @unknown()
-; ATTRIBUTOR-NEXT: [[P:%.*]] = call nonnull dereferenceable(101) i32* @unkown_ptr()
-; ATTRIBUTOR-NEXT: call void @unknown_use32(i32* nonnull dereferenceable(101) [[P]])
-; ATTRIBUTOR-NEXT: call void @unknown_use8(i8* nonnull dereferenceable(42) [[ARG4]])
-; ATTRIBUTOR-NEXT: call void @unknown_use8(i8* nonnull [[ARG3]])
-; ATTRIBUTOR-NEXT: call void @unknown_use8(i8* nonnull dereferenceable(31) [[ARG2]])
-; ATTRIBUTOR-NEXT: call void @unknown_use8(i8* nonnull dereferenceable(2) [[ARG1]])
-; ATTRIBUTOR-NEXT: call void @llvm.assume(i1 true) [ "nonnull"(i8* [[ARG3]]), "dereferenceable"(i8* [[ARG1]], i64 1), "dereferenceable"(i8* [[ARG1]], i64 2), "dereferenceable"(i32* [[P]], i64 101), "dereferenceable_or_null"(i8* [[ARG2]], i64 31), "dereferenceable_or_null"(i8* [[ARG4]], i64 42) ]
-; ATTRIBUTOR-NEXT: call void @unknown_use8(i8* nonnull dereferenceable(2) [[ARG1]])
-; ATTRIBUTOR-NEXT: call void @unknown_use8(i8* nonnull dereferenceable(31) [[ARG2]])
-; ATTRIBUTOR-NEXT: call void @unknown_use8(i8* nonnull [[ARG3]])
-; ATTRIBUTOR-NEXT: call void @unknown_use8(i8* nonnull dereferenceable(42) [[ARG4]])
-; ATTRIBUTOR-NEXT: call void @unknown_use32(i32* nonnull dereferenceable(101) [[P]])
+; ATTRIBUTOR-NEXT: [[P:%.*]] = call nonnull dereferenceable(101) ptr @unkown_ptr()
+; ATTRIBUTOR-NEXT: call void @unknown_use32(ptr nonnull dereferenceable(101) [[P]])
+; ATTRIBUTOR-NEXT: call void @unknown_use8(ptr nonnull dereferenceable(42) [[ARG4]])
+; ATTRIBUTOR-NEXT: call void @unknown_use8(ptr nonnull [[ARG3]])
+; ATTRIBUTOR-NEXT: call void @unknown_use8(ptr nonnull dereferenceable(31) [[ARG2]])
+; ATTRIBUTOR-NEXT: call void @unknown_use8(ptr nonnull dereferenceable(2) [[ARG1]])
+; ATTRIBUTOR-NEXT: call void @llvm.assume(i1 true) [ "nonnull"(ptr [[ARG3]]), "dereferenceable"(ptr [[ARG1]], i64 1), "dereferenceable"(ptr [[ARG1]], i64 2), "dereferenceable"(ptr [[P]], i64 101), "dereferenceable_or_null"(ptr [[ARG2]], i64 31), "dereferenceable_or_null"(ptr [[ARG4]], i64 42) ]
+; ATTRIBUTOR-NEXT: call void @unknown_use8(ptr nonnull dereferenceable(2) [[ARG1]])
+; ATTRIBUTOR-NEXT: call void @unknown_use8(ptr nonnull dereferenceable(31) [[ARG2]])
+; ATTRIBUTOR-NEXT: call void @unknown_use8(ptr nonnull [[ARG3]])
+; ATTRIBUTOR-NEXT: call void @unknown_use8(ptr nonnull dereferenceable(42) [[ARG4]])
+; ATTRIBUTOR-NEXT: call void @unknown_use32(ptr nonnull dereferenceable(101) [[P]])
; ATTRIBUTOR-NEXT: call void @unknown()
; ATTRIBUTOR-NEXT: ret void
;
; TUNIT-LABEL: define {{[^@]+}}@nonnull_assume_call
-; TUNIT-SAME: (i8* [[ARG1:%.*]], i8* [[ARG2:%.*]], i8* [[ARG3:%.*]], i8* [[ARG4:%.*]]) {
+; TUNIT-SAME: (ptr [[ARG1:%.*]], ptr [[ARG2:%.*]], ptr [[ARG3:%.*]], ptr [[ARG4:%.*]]) {
; TUNIT-NEXT: call void @unknown()
-; TUNIT-NEXT: [[P:%.*]] = call nonnull dereferenceable(101) i32* @unkown_ptr() #[[ATTR9:[0-9]+]]
-; TUNIT-NEXT: call void @unknown_use32(i32* nonnull dereferenceable(101) [[P]]) #[[ATTR9]]
-; TUNIT-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(42) [[ARG4]]) #[[ATTR9]]
-; TUNIT-NEXT: call void @unknown_use8(i8* nonnull [[ARG3]]) #[[ATTR9]]
-; TUNIT-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(31) [[ARG2]]) #[[ATTR9]]
-; TUNIT-NEXT: call void @unknown_use8(i8* nonnull dereferenceable(2) [[ARG1]]) #[[ATTR9]]
-; TUNIT-NEXT: call void @llvm.assume(i1 noundef true) [ "nonnull"(i8* [[ARG3]]), "dereferenceable"(i8* [[ARG1]], i64 1), "dereferenceable"(i8* [[ARG1]], i64 2), "dereferenceable"(i32* [[P]], i64 101), "dereferenceable_or_null"(i8* [[ARG2]], i64 31), "dereferenceable_or_null"(i8* [[ARG4]], i64 42) ]
-; TUNIT-NEXT: call void @unknown_use8(i8* nonnull dereferenceable(2) [[ARG1]]) #[[ATTR9]]
-; TUNIT-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(31) [[ARG2]]) #[[ATTR9]]
-; TUNIT-NEXT: call void @unknown_use8(i8* nonnull [[ARG3]]) #[[ATTR9]]
-; TUNIT-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(42) [[ARG4]]) #[[ATTR9]]
-; TUNIT-NEXT: call void @unknown_use32(i32* nonnull dereferenceable(101) [[P]]) #[[ATTR9]]
+; TUNIT-NEXT: [[P:%.*]] = call nonnull dereferenceable(101) ptr @unkown_ptr() #[[ATTR9:[0-9]+]]
+; TUNIT-NEXT: call void @unknown_use32(ptr nonnull dereferenceable(101) [[P]]) #[[ATTR9]]
+; TUNIT-NEXT: call void @unknown_use8(ptr dereferenceable_or_null(42) [[ARG4]]) #[[ATTR9]]
+; TUNIT-NEXT: call void @unknown_use8(ptr nonnull [[ARG3]]) #[[ATTR9]]
+; TUNIT-NEXT: call void @unknown_use8(ptr dereferenceable_or_null(31) [[ARG2]]) #[[ATTR9]]
+; TUNIT-NEXT: call void @unknown_use8(ptr nonnull dereferenceable(2) [[ARG1]]) #[[ATTR9]]
+; TUNIT-NEXT: call void @llvm.assume(i1 noundef true) [ "nonnull"(ptr [[ARG3]]), "dereferenceable"(ptr [[ARG1]], i64 1), "dereferenceable"(ptr [[ARG1]], i64 2), "dereferenceable"(ptr [[P]], i64 101), "dereferenceable_or_null"(ptr [[ARG2]], i64 31), "dereferenceable_or_null"(ptr [[ARG4]], i64 42) ]
+; TUNIT-NEXT: call void @unknown_use8(ptr nonnull dereferenceable(2) [[ARG1]]) #[[ATTR9]]
+; TUNIT-NEXT: call void @unknown_use8(ptr dereferenceable_or_null(31) [[ARG2]]) #[[ATTR9]]
+; TUNIT-NEXT: call void @unknown_use8(ptr nonnull [[ARG3]]) #[[ATTR9]]
+; TUNIT-NEXT: call void @unknown_use8(ptr dereferenceable_or_null(42) [[ARG4]]) #[[ATTR9]]
+; TUNIT-NEXT: call void @unknown_use32(ptr nonnull dereferenceable(101) [[P]]) #[[ATTR9]]
; TUNIT-NEXT: call void @unknown()
; TUNIT-NEXT: ret void
;
; CGSCC-LABEL: define {{[^@]+}}@nonnull_assume_call
-; CGSCC-SAME: (i8* [[ARG1:%.*]], i8* [[ARG2:%.*]], i8* [[ARG3:%.*]], i8* [[ARG4:%.*]]) {
+; CGSCC-SAME: (ptr [[ARG1:%.*]], ptr [[ARG2:%.*]], ptr [[ARG3:%.*]], ptr [[ARG4:%.*]]) {
; CGSCC-NEXT: call void @unknown()
-; CGSCC-NEXT: [[P:%.*]] = call nonnull dereferenceable(101) i32* @unkown_ptr() #[[ATTR8:[0-9]+]]
-; CGSCC-NEXT: call void @unknown_use32(i32* nonnull dereferenceable(101) [[P]]) #[[ATTR8]]
-; CGSCC-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(42) [[ARG4]]) #[[ATTR8]]
-; CGSCC-NEXT: call void @unknown_use8(i8* nonnull [[ARG3]]) #[[ATTR8]]
-; CGSCC-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(31) [[ARG2]]) #[[ATTR8]]
-; CGSCC-NEXT: call void @unknown_use8(i8* nonnull dereferenceable(2) [[ARG1]]) #[[ATTR8]]
-; CGSCC-NEXT: call void @llvm.assume(i1 noundef true) [ "nonnull"(i8* [[ARG3]]), "dereferenceable"(i8* [[ARG1]], i64 1), "dereferenceable"(i8* [[ARG1]], i64 2), "dereferenceable"(i32* [[P]], i64 101), "dereferenceable_or_null"(i8* [[ARG2]], i64 31), "dereferenceable_or_null"(i8* [[ARG4]], i64 42) ]
-; CGSCC-NEXT: call void @unknown_use8(i8* nonnull dereferenceable(2) [[ARG1]]) #[[ATTR8]]
-; CGSCC-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(31) [[ARG2]]) #[[ATTR8]]
-; CGSCC-NEXT: call void @unknown_use8(i8* nonnull [[ARG3]]) #[[ATTR8]]
-; CGSCC-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(42) [[ARG4]]) #[[ATTR8]]
-; CGSCC-NEXT: call void @unknown_use32(i32* nonnull dereferenceable(101) [[P]]) #[[ATTR8]]
+; CGSCC-NEXT: [[P:%.*]] = call nonnull dereferenceable(101) ptr @unkown_ptr() #[[ATTR8:[0-9]+]]
+; CGSCC-NEXT: call void @unknown_use32(ptr nonnull dereferenceable(101) [[P]]) #[[ATTR8]]
+; CGSCC-NEXT: call void @unknown_use8(ptr dereferenceable_or_null(42) [[ARG4]]) #[[ATTR8]]
+; CGSCC-NEXT: call void @unknown_use8(ptr nonnull [[ARG3]]) #[[ATTR8]]
+; CGSCC-NEXT: call void @unknown_use8(ptr dereferenceable_or_null(31) [[ARG2]]) #[[ATTR8]]
+; CGSCC-NEXT: call void @unknown_use8(ptr nonnull dereferenceable(2) [[ARG1]]) #[[ATTR8]]
+; CGSCC-NEXT: call void @llvm.assume(i1 noundef true) [ "nonnull"(ptr [[ARG3]]), "dereferenceable"(ptr [[ARG1]], i64 1), "dereferenceable"(ptr [[ARG1]], i64 2), "dereferenceable"(ptr [[P]], i64 101), "dereferenceable_or_null"(ptr [[ARG2]], i64 31), "dereferenceable_or_null"(ptr [[ARG4]], i64 42) ]
+; CGSCC-NEXT: call void @unknown_use8(ptr nonnull dereferenceable(2) [[ARG1]]) #[[ATTR8]]
+; CGSCC-NEXT: call void @unknown_use8(ptr dereferenceable_or_null(31) [[ARG2]]) #[[ATTR8]]
+; CGSCC-NEXT: call void @unknown_use8(ptr nonnull [[ARG3]]) #[[ATTR8]]
+; CGSCC-NEXT: call void @unknown_use8(ptr dereferenceable_or_null(42) [[ARG4]]) #[[ATTR8]]
+; CGSCC-NEXT: call void @unknown_use32(ptr nonnull dereferenceable(101) [[P]]) #[[ATTR8]]
; CGSCC-NEXT: call void @unknown()
; CGSCC-NEXT: ret void
;
call void @unknown()
- %p = call i32* @unkown_ptr()
- call void @unknown_use32(i32* %p)
- call void @unknown_use8(i8* %arg4)
- call void @unknown_use8(i8* %arg3)
- call void @unknown_use8(i8* %arg2)
- call void @unknown_use8(i8* %arg1)
- call void @llvm.assume(i1 true) [ "nonnull"(i8* %arg3), "dereferenceable"(i8* %arg1, i64 1), "dereferenceable"(i8* %arg1, i64 2), "dereferenceable"(i32* %p, i64 101), "dereferenceable_or_null"(i8* %arg2, i64 31), "dereferenceable_or_null"(i8* %arg4, i64 42)]
- call void @unknown_use8(i8* %arg1)
- call void @unknown_use8(i8* %arg2)
- call void @unknown_use8(i8* %arg3)
- call void @unknown_use8(i8* %arg4)
- call void @unknown_use32(i32* %p)
+ %p = call ptr @unkown_ptr()
+ call void @unknown_use32(ptr %p)
+ call void @unknown_use8(ptr %arg4)
+ call void @unknown_use8(ptr %arg3)
+ call void @unknown_use8(ptr %arg2)
+ call void @unknown_use8(ptr %arg1)
+ call void @llvm.assume(i1 true) [ "nonnull"(ptr %arg3), "dereferenceable"(ptr %arg1, i64 1), "dereferenceable"(ptr %arg1, i64 2), "dereferenceable"(ptr %p, i64 101), "dereferenceable_or_null"(ptr %arg2, i64 31), "dereferenceable_or_null"(ptr %arg4, i64 42)]
+ call void @unknown_use8(ptr %arg1)
+ call void @unknown_use8(ptr %arg2)
+ call void @unknown_use8(ptr %arg3)
+ call void @unknown_use8(ptr %arg4)
+ call void @unknown_use32(ptr %p)
call void @unknown()
ret void
}
-declare void @unknown_use8(i8*) willreturn nounwind
-declare void @unknown_use32(i32*) willreturn nounwind
+declare void @unknown_use8(ptr) willreturn nounwind
+declare void @unknown_use32(ptr) willreturn nounwind
declare void @llvm.assume(i1)
@g = global i64 0
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
; CHECK: t:
-; CHECK-NEXT: [[GEP:%.*]] = getelementptr i8, i8* bitcast (i64* @g to i8*), i64 2
+; CHECK-NEXT: [[GEP:%.*]] = getelementptr i8, ptr @g, i64 2
; CHECK-NEXT: br label [[F]]
; CHECK: f:
-; CHECK-NEXT: [[PHI:%.*]] = phi i8* [ [[GEP]], [[T]] ], [ bitcast (i64* @g to i8*), [[ENTRY:%.*]] ]
-; CHECK-NEXT: call void @unknown_use8(i8* noundef align 2 dereferenceable_or_null(6) [[PHI]]) #[[ATTR1]]
+; CHECK-NEXT: [[PHI:%.*]] = phi ptr [ [[GEP]], [[T]] ], [ @g, [[ENTRY:%.*]] ]
+; CHECK-NEXT: call void @unknown_use8(ptr noundef align 2 dereferenceable_or_null(6) [[PHI]]) #[[ATTR1]]
; CHECK-NEXT: ret void
;
entry:
- %bc = bitcast i64* @g to i8*
br i1 %c, label %t, label %f
t:
- %gep = getelementptr i8, i8* %bc, i64 2
+ %gep = getelementptr i8, ptr @g, i64 2
br label %f
f:
- %phi = phi i8* [%gep, %t], [%bc, %entry]
- call void @unknown_use8(i8* %phi)
+ %phi = phi ptr [%gep, %t], [@g, %entry]
+ call void @unknown_use8(ptr %phi)
ret void
}
; called functions inlined. This essentially produces two loops, once
; specialized for each comparison.
;
-; CHECK: %tmp3 = call i1 %cmp(i64* %tmp1, i64* %tmp2), !callees ![[MD:[0-9]+]]
-; CHECK: ![[MD]] = !{i1 (i64*, i64*)* @ugt, i1 (i64*, i64*)* @ule}
+; CHECK: %tmp3 = call i1 %cmp(ptr %tmp1, ptr %tmp2), !callees ![[MD:[0-9]+]]
+; CHECK: ![[MD]] = !{ptr @ugt, ptr @ule}
;
-define void @test_argument(i64* %x, i64 %n, i1 %flag) {
+define void @test_argument(ptr %x, i64 %n, i1 %flag) {
entry:
%tmp0 = sub i64 %n, 1
br i1 %flag, label %then, label %else
then:
- call void @arrange_data(i64* %x, i64 %tmp0, i1 (i64*, i64*)* @ugt)
+ call void @arrange_data(ptr %x, i64 %tmp0, ptr @ugt)
br label %merge
else:
- call void @arrange_data(i64* %x, i64 %tmp0, i1 (i64*, i64*)* @ule)
+ call void @arrange_data(ptr %x, i64 %tmp0, ptr @ule)
br label %merge
merge:
ret void
}
-define internal void @arrange_data(i64* %x, i64 %n, i1 (i64*, i64*)* %cmp) {
+define internal void @arrange_data(ptr %x, i64 %n, ptr %cmp) {
entry:
%tmp0 = icmp eq i64 %n, 1
br i1 %tmp0, label %merge, label %for.body
for.body:
%i = phi i64 [ 0, %entry ], [ %i.next, %cmp.false ]
%i.next = add nuw nsw i64 %i, 1
- %tmp1 = getelementptr inbounds i64, i64* %x, i64 %i
- %tmp2 = getelementptr inbounds i64, i64* %x, i64 %i.next
- %tmp3 = call i1 %cmp(i64* %tmp1, i64* %tmp2)
+ %tmp1 = getelementptr inbounds i64, ptr %x, i64 %i
+ %tmp2 = getelementptr inbounds i64, ptr %x, i64 %i.next
+ %tmp3 = call i1 %cmp(ptr %tmp1, ptr %tmp2)
br i1 %tmp3, label %cmp.true, label %cmp.false
cmp.true:
- call void @swap(i64* %tmp1, i64* %tmp2)
+ call void @swap(ptr %tmp1, ptr %tmp2)
br label %cmp.false
cmp.false:
for.end:
%tmp4 = sub i64 %n, 1
- call void @arrange_data(i64* %x, i64 %tmp4, i1 (i64*, i64*)* %cmp)
+ call void @arrange_data(ptr %x, i64 %tmp4, ptr %cmp)
br label %merge
merge:
ret void
}
-define internal i1 @ugt(i64* %a, i64* %b) {
+define internal i1 @ugt(ptr %a, ptr %b) {
entry:
- %tmp0 = load i64, i64* %a
- %tmp1 = load i64, i64* %b
+ %tmp0 = load i64, ptr %a
+ %tmp1 = load i64, ptr %b
%tmp2 = icmp ugt i64 %tmp0, %tmp1
ret i1 %tmp2
}
-define internal i1 @ule(i64* %a, i64* %b) {
+define internal i1 @ule(ptr %a, ptr %b) {
entry:
- %tmp0 = load i64, i64* %a
- %tmp1 = load i64, i64* %b
+ %tmp0 = load i64, ptr %a
+ %tmp1 = load i64, ptr %b
%tmp2 = icmp ule i64 %tmp0, %tmp1
ret i1 %tmp2
}
-declare void @swap(i64*, i64*)
+declare void @swap(ptr, ptr)
; RUN: opt -S < %s -passes=partial-inliner -partial-inlining-extra-penalty=10 | FileCheck %s
-define i32 @outline_region_notlikely(i32* %arg) local_unnamed_addr {
+define i32 @outline_region_notlikely(ptr %arg) local_unnamed_addr {
bb:
; ptr != null is predicted to be true
- %tmp = icmp ne i32* %arg, null
+ %tmp = icmp ne ptr %arg, null
br i1 %tmp, label %bb8, label %bb1
; bb1 is not likely
bb1: ; preds = %bb
- %tmp2 = tail call i32 @foo(i32* nonnull %arg)
- %tmp3 = tail call i32 @foo(i32* nonnull %arg)
- %tmp4 = tail call i32 @foo(i32* nonnull %arg)
- %tmp5 = tail call i32 @foo(i32* nonnull %arg)
- %tmp6 = tail call i32 @foo(i32* nonnull %arg)
- %tmp7 = tail call i32 @foo(i32* nonnull %arg)
+ %tmp2 = tail call i32 @foo(ptr nonnull %arg)
+ %tmp3 = tail call i32 @foo(ptr nonnull %arg)
+ %tmp4 = tail call i32 @foo(ptr nonnull %arg)
+ %tmp5 = tail call i32 @foo(ptr nonnull %arg)
+ %tmp6 = tail call i32 @foo(ptr nonnull %arg)
+ %tmp7 = tail call i32 @foo(ptr nonnull %arg)
br label %bb8
bb8: ; preds = %bb1, %bb
ret i32 %tmp9
}
-define i32 @outline_region_likely(i32* %arg) local_unnamed_addr {
+define i32 @outline_region_likely(ptr %arg) local_unnamed_addr {
bb:
; ptr == null is predicted to be false
- %tmp = icmp eq i32* %arg, null
+ %tmp = icmp eq ptr %arg, null
br i1 %tmp, label %bb8, label %bb1
; bb1 is likely
bb1: ; preds = %bb
- %tmp2 = tail call i32 @foo(i32* nonnull %arg)
- %tmp3 = tail call i32 @foo(i32* nonnull %arg)
- %tmp4 = tail call i32 @foo(i32* nonnull %arg)
- %tmp5 = tail call i32 @foo(i32* nonnull %arg)
- %tmp6 = tail call i32 @foo(i32* nonnull %arg)
- %tmp7 = tail call i32 @foo(i32* nonnull %arg)
+ %tmp2 = tail call i32 @foo(ptr nonnull %arg)
+ %tmp3 = tail call i32 @foo(ptr nonnull %arg)
+ %tmp4 = tail call i32 @foo(ptr nonnull %arg)
+ %tmp5 = tail call i32 @foo(ptr nonnull %arg)
+ %tmp6 = tail call i32 @foo(ptr nonnull %arg)
+ %tmp7 = tail call i32 @foo(ptr nonnull %arg)
br label %bb8
bb8: ; preds = %bb1, %bb
ret i32 %tmp9
}
-declare i32 @foo(i32* %arg)
+declare i32 @foo(ptr %arg)
-define i32 @dummy_caller(i32* %arg) local_unnamed_addr {
+define i32 @dummy_caller(ptr %arg) local_unnamed_addr {
; CHECK-LABEL: @dummy_caller
- %tmp = call i32 @outline_region_notlikely(i32* %arg)
+ %tmp = call i32 @outline_region_notlikely(ptr %arg)
; CHECK: call void @outline_region_notlikely.2.bb1
- %tmp2 = tail call i32 @outline_region_likely(i32* %arg)
-; CHECK: %tmp2 = tail call i32 @outline_region_likely(i32* %arg)
+ %tmp2 = tail call i32 @outline_region_likely(ptr %arg)
+; CHECK: %tmp2 = tail call i32 @outline_region_likely(ptr %arg)
ret i32 %tmp
}
-; CHECK-LABEL: define internal void @outline_region_notlikely.2.bb1(i32* %arg) {
+; CHECK-LABEL: define internal void @outline_region_notlikely.2.bb1(ptr %arg) {
; CHECK-NEXT: newFuncRoot:
!llvm.module.flags = !{!0}
; RUN: opt -S < %s -passes=partial-inliner -partial-inlining-extra-penalty=2000 | FileCheck %s
-define i32 @outline_region_notlikely(i32* %arg) local_unnamed_addr {
+define i32 @outline_region_notlikely(ptr %arg) local_unnamed_addr {
bb:
; ptr != null is predicted to be true
- %tmp = icmp ne i32* %arg, null
+ %tmp = icmp ne ptr %arg, null
br i1 %tmp, label %bb8, label %bb1, !prof !2
; bb1 is not likely
bb1: ; preds = %bb
- %tmp2 = tail call i32 @foo(i32* nonnull %arg)
- %tmp3 = tail call i32 @foo(i32* nonnull %arg)
- %tmp4 = tail call i32 @foo(i32* nonnull %arg)
- %tmp5 = tail call i32 @foo(i32* nonnull %arg)
- %tmp6 = tail call i32 @foo(i32* nonnull %arg)
- %tmp7 = tail call i32 @foo(i32* nonnull %arg)
+ %tmp2 = tail call i32 @foo(ptr nonnull %arg)
+ %tmp3 = tail call i32 @foo(ptr nonnull %arg)
+ %tmp4 = tail call i32 @foo(ptr nonnull %arg)
+ %tmp5 = tail call i32 @foo(ptr nonnull %arg)
+ %tmp6 = tail call i32 @foo(ptr nonnull %arg)
+ %tmp7 = tail call i32 @foo(ptr nonnull %arg)
br label %bb8
bb8: ; preds = %bb1, %bb
ret i32 %tmp9
}
-define i32 @dummy_caller(i32* %arg) local_unnamed_addr {
+define i32 @dummy_caller(ptr %arg) local_unnamed_addr {
; CHECK-LABEL: @dummy_caller
- %tmp = call i32 @outline_region_notlikely(i32* %arg)
+ %tmp = call i32 @outline_region_notlikely(ptr %arg)
ret i32 %tmp
}
-; CHECK-LABEL: define internal void @outline_region_notlikely.1.bb1(i32* %arg) {
+; CHECK-LABEL: define internal void @outline_region_notlikely.1.bb1(ptr %arg) {
; CHECK-NEXT: newFuncRoot:
-declare i32 @foo(i32 * %arg)
+declare i32 @foo(ptr %arg)
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
target datalayout = "p:64:64:64"
-declare {i8*, i8*, i32} @prototype_f(i8*, i1)
-define {i8*, i8*, i32} @f(i8* %buffer, i32 %n, { i32 } %dummy) {
+declare {ptr, ptr, i32} @prototype_f(ptr, i1)
+define {ptr, ptr, i32} @f(ptr %buffer, i32 %n, { i32 } %dummy) {
; CHECK-LABEL: @f(
; CHECK-NEXT: coro.return:
; CHECK-NEXT: [[N_VAL_SPILL_ADDR:%.*]] = getelementptr inbounds [[F_FRAME:%.*]], ptr [[BUFFER:%.*]], i64 0, i32 1
; CHECK-NEXT: ret { ptr, ptr, i32 } [[TMP2]]
;
entry:
- %id = call token @llvm.coro.id.retcon(i32 1024, i32 8, i8* %buffer, i8* bitcast ({i8*, i8*, i32} (i8*, i1)* @prototype_f to i8*), i8* bitcast (i8* (i32)* @allocate to i8*), i8* bitcast (void (i8*)* @deallocate to i8*))
- %hdl = call i8* @llvm.coro.begin(token %id, i8* null)
+ %id = call token @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_f, ptr @allocate, ptr @deallocate)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr null)
br label %loop
loop:
%n.val = phi i32 [ %n, %entry ], [ %inc, %resume ]
%alloca = call token @llvm.coro.alloca.alloc.i32(i32 %n.val, i32 8)
- %ptr = call i8* @llvm.coro.alloca.get(token %alloca)
- %unwind = call i1 (...) @llvm.coro.suspend.retcon.i1(i8* %ptr, i32 %n.val)
+ %ptr = call ptr @llvm.coro.alloca.get(token %alloca)
+ %unwind = call i1 (...) @llvm.coro.suspend.retcon.i1(ptr %ptr, i32 %n.val)
call void @llvm.coro.alloca.free(token %alloca)
br i1 %unwind, label %cleanup, label %resume
br label %loop
cleanup:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
unreachable
}
-declare {i8*, i32} @prototype_g(i8*, i1)
-define {i8*, i32} @g(i8* %buffer, i32 %n) {
+declare {ptr, i32} @prototype_g(ptr, i1)
+define {ptr, i32} @g(ptr %buffer, i32 %n) {
; CHECK-LABEL: @g(
; CHECK-NEXT: coro.return:
; CHECK-NEXT: store i32 [[N:%.*]], ptr [[BUFFER:%.*]], align 4
; CHECK-NEXT: ret { ptr, i32 } [[TMP2]]
;
entry:
- %id = call token @llvm.coro.id.retcon(i32 1024, i32 8, i8* %buffer, i8* bitcast ({i8*, i32} (i8*, i1)* @prototype_g to i8*), i8* bitcast (i8* (i32)* @allocate to i8*), i8* bitcast (void (i8*)* @deallocate to i8*))
- %hdl = call i8* @llvm.coro.begin(token %id, i8* null)
+ %id = call token @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_g, ptr @allocate, ptr @deallocate)
+ %hdl = call ptr @llvm.coro.begin(token %id, ptr null)
br label %loop
loop:
%n.val = phi i32 [ %n, %entry ], [ %inc, %resume ]
%alloca = call token @llvm.coro.alloca.alloc.i32(i32 %n.val, i32 8)
- %ptr = call i8* @llvm.coro.alloca.get(token %alloca)
- call void @use(i8* %ptr)
+ %ptr = call ptr @llvm.coro.alloca.get(token %alloca)
+ call void @use(ptr %ptr)
call void @llvm.coro.alloca.free(token %alloca)
%unwind = call i1 (...) @llvm.coro.suspend.retcon.i1(i32 %n.val)
br i1 %unwind, label %cleanup, label %resume
br label %loop
cleanup:
- call i1 @llvm.coro.end(i8* %hdl, i1 0)
+ call i1 @llvm.coro.end(ptr %hdl, i1 0)
unreachable
}
-declare token @llvm.coro.id.retcon(i32, i32, i8*, i8*, i8*, i8*)
-declare i8* @llvm.coro.begin(token, i8*)
+declare token @llvm.coro.id.retcon(i32, i32, ptr, ptr, ptr, ptr)
+declare ptr @llvm.coro.begin(token, ptr)
declare i1 @llvm.coro.suspend.retcon.i1(...)
declare void @llvm.coro.suspend.retcon.isVoid(...)
-declare i1 @llvm.coro.end(i8*, i1)
-declare i8* @llvm.coro.prepare.retcon(i8*)
+declare i1 @llvm.coro.end(ptr, i1)
+declare ptr @llvm.coro.prepare.retcon(ptr)
declare token @llvm.coro.alloca.alloc.i32(i32, i32)
-declare i8* @llvm.coro.alloca.get(token)
+declare ptr @llvm.coro.alloca.get(token)
declare void @llvm.coro.alloca.free(token)
-declare noalias i8* @allocate(i32 %size)
-declare void @deallocate(i8* %ptr)
+declare noalias ptr @allocate(i32 %size)
+declare void @deallocate(ptr %ptr)
declare void @print(i32)
-declare void @use(i8*)
+declare void @use(ptr)
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=correlated-propagation -S | FileCheck %s
-define void @test1(i8* %ptr) {
+define void @test1(ptr %ptr) {
; CHECK-LABEL: @test1(
-; CHECK-NEXT: [[A:%.*]] = load i8, i8* [[PTR:%.*]], align 1
+; CHECK-NEXT: [[A:%.*]] = load i8, ptr [[PTR:%.*]], align 1
; CHECK-NEXT: br label [[BB:%.*]]
; CHECK: bb:
; CHECK-NEXT: ret void
;
- %A = load i8, i8* %ptr
+ %A = load i8, ptr %ptr
br label %bb
bb:
- icmp ne i8* %ptr, null
+ icmp ne ptr %ptr, null
ret void
}
-define void @test1_no_null_opt(i8* %ptr) #0 {
+define void @test1_no_null_opt(ptr %ptr) #0 {
; CHECK-LABEL: @test1_no_null_opt(
-; CHECK-NEXT: [[A:%.*]] = load i8, i8* [[PTR:%.*]], align 1
+; CHECK-NEXT: [[A:%.*]] = load i8, ptr [[PTR:%.*]], align 1
; CHECK-NEXT: br label [[BB:%.*]]
; CHECK: bb:
-; CHECK-NEXT: [[TMP1:%.*]] = icmp ne i8* [[PTR]], null
+; CHECK-NEXT: [[TMP1:%.*]] = icmp ne ptr [[PTR]], null
; CHECK-NEXT: ret void
;
- %A = load i8, i8* %ptr
+ %A = load i8, ptr %ptr
br label %bb
bb:
- icmp ne i8* %ptr, null
+ icmp ne ptr %ptr, null
ret void
}
-define void @test2(i8* %ptr) {
+define void @test2(ptr %ptr) {
; CHECK-LABEL: @test2(
-; CHECK-NEXT: store i8 0, i8* [[PTR:%.*]], align 1
+; CHECK-NEXT: store i8 0, ptr [[PTR:%.*]], align 1
; CHECK-NEXT: br label [[BB:%.*]]
; CHECK: bb:
; CHECK-NEXT: ret void
;
- store i8 0, i8* %ptr
+ store i8 0, ptr %ptr
br label %bb
bb:
- icmp ne i8* %ptr, null
+ icmp ne ptr %ptr, null
ret void
}
-define void @test2_no_null_opt(i8* %ptr) #0 {
+define void @test2_no_null_opt(ptr %ptr) #0 {
; CHECK-LABEL: @test2_no_null_opt(
-; CHECK-NEXT: store i8 0, i8* [[PTR:%.*]], align 1
+; CHECK-NEXT: store i8 0, ptr [[PTR:%.*]], align 1
; CHECK-NEXT: br label [[BB:%.*]]
; CHECK: bb:
-; CHECK-NEXT: [[TMP1:%.*]] = icmp ne i8* [[PTR]], null
+; CHECK-NEXT: [[TMP1:%.*]] = icmp ne ptr [[PTR]], null
; CHECK-NEXT: ret void
;
- store i8 0, i8* %ptr
+ store i8 0, ptr %ptr
br label %bb
bb:
- icmp ne i8* %ptr, null
+ icmp ne ptr %ptr, null
ret void
}
%ptr = alloca i8
br label %bb
bb:
- icmp ne i8* %ptr, null
+ icmp ne ptr %ptr, null
ret void
}
%ptr = alloca i8
br label %bb
bb:
- icmp ne i8* %ptr, null
+ icmp ne ptr %ptr, null
ret void
}
-declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i1)
+declare void @llvm.memcpy.p0.p0.i32(ptr, ptr, i32, i1)
-define void @test4(i8* %dest, i8* %src) {
+define void @test4(ptr %dest, ptr %src) {
; CHECK-LABEL: @test4(
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[DEST:%.*]], i8* [[SRC:%.*]], i32 1, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[DEST:%.*]], ptr [[SRC:%.*]], i32 1, i1 false)
; CHECK-NEXT: br label [[BB:%.*]]
; CHECK: bb:
; CHECK-NEXT: ret void
;
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 1, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr %dest, ptr %src, i32 1, i1 false)
br label %bb
bb:
- icmp ne i8* %dest, null
- icmp ne i8* %src, null
+ icmp ne ptr %dest, null
+ icmp ne ptr %src, null
ret void
}
-define void @test4_no_null_opt(i8* %dest, i8* %src) #0 {
+define void @test4_no_null_opt(ptr %dest, ptr %src) #0 {
; CHECK-LABEL: @test4_no_null_opt(
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[DEST:%.*]], i8* [[SRC:%.*]], i32 1, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[DEST:%.*]], ptr [[SRC:%.*]], i32 1, i1 false)
; CHECK-NEXT: br label [[BB:%.*]]
; CHECK: bb:
-; CHECK-NEXT: [[TMP1:%.*]] = icmp ne i8* [[DEST]], null
-; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i8* [[SRC]], null
+; CHECK-NEXT: [[TMP1:%.*]] = icmp ne ptr [[DEST]], null
+; CHECK-NEXT: [[TMP2:%.*]] = icmp ne ptr [[SRC]], null
; CHECK-NEXT: ret void
;
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 1, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr %dest, ptr %src, i32 1, i1 false)
br label %bb
bb:
- icmp ne i8* %dest, null
- icmp ne i8* %src, null
+ icmp ne ptr %dest, null
+ icmp ne ptr %src, null
ret void
}
-declare void @llvm.memmove.p0i8.p0i8.i32(i8*, i8*, i32, i1)
-define void @test5(i8* %dest, i8* %src) {
+declare void @llvm.memmove.p0.p0.i32(ptr, ptr, i32, i1)
+define void @test5(ptr %dest, ptr %src) {
; CHECK-LABEL: @test5(
-; CHECK-NEXT: call void @llvm.memmove.p0i8.p0i8.i32(i8* [[DEST:%.*]], i8* [[SRC:%.*]], i32 1, i1 false)
+; CHECK-NEXT: call void @llvm.memmove.p0.p0.i32(ptr [[DEST:%.*]], ptr [[SRC:%.*]], i32 1, i1 false)
; CHECK-NEXT: br label [[BB:%.*]]
; CHECK: bb:
; CHECK-NEXT: ret void
;
- call void @llvm.memmove.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 1, i1 false)
+ call void @llvm.memmove.p0.p0.i32(ptr %dest, ptr %src, i32 1, i1 false)
br label %bb
bb:
- icmp ne i8* %dest, null
- icmp ne i8* %src, null
+ icmp ne ptr %dest, null
+ icmp ne ptr %src, null
ret void
}
-define void @test5_no_null_opt(i8* %dest, i8* %src) #0 {
+define void @test5_no_null_opt(ptr %dest, ptr %src) #0 {
; CHECK-LABEL: @test5_no_null_opt(
-; CHECK-NEXT: call void @llvm.memmove.p0i8.p0i8.i32(i8* [[DEST:%.*]], i8* [[SRC:%.*]], i32 1, i1 false)
+; CHECK-NEXT: call void @llvm.memmove.p0.p0.i32(ptr [[DEST:%.*]], ptr [[SRC:%.*]], i32 1, i1 false)
; CHECK-NEXT: br label [[BB:%.*]]
; CHECK: bb:
-; CHECK-NEXT: [[TMP1:%.*]] = icmp ne i8* [[DEST]], null
-; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i8* [[SRC]], null
+; CHECK-NEXT: [[TMP1:%.*]] = icmp ne ptr [[DEST]], null
+; CHECK-NEXT: [[TMP2:%.*]] = icmp ne ptr [[SRC]], null
; CHECK-NEXT: ret void
;
- call void @llvm.memmove.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 1, i1 false)
+ call void @llvm.memmove.p0.p0.i32(ptr %dest, ptr %src, i32 1, i1 false)
br label %bb
bb:
- icmp ne i8* %dest, null
- icmp ne i8* %src, null
+ icmp ne ptr %dest, null
+ icmp ne ptr %src, null
ret void
}
-declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i1)
-define void @test6(i8* %dest) {
+declare void @llvm.memset.p0.i32(ptr, i8, i32, i1)
+define void @test6(ptr %dest) {
; CHECK-LABEL: @test6(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* [[DEST:%.*]], i8 -1, i32 1, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i32(ptr [[DEST:%.*]], i8 -1, i32 1, i1 false)
; CHECK-NEXT: br label [[BB:%.*]]
; CHECK: bb:
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i32(i8* %dest, i8 255, i32 1, i1 false)
+ call void @llvm.memset.p0.i32(ptr %dest, i8 255, i32 1, i1 false)
br label %bb
bb:
- icmp ne i8* %dest, null
+ icmp ne ptr %dest, null
ret void
}
-define void @test6_no_null_opt(i8* %dest) #0 {
+define void @test6_no_null_opt(ptr %dest) #0 {
; CHECK-LABEL: @test6_no_null_opt(
-; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* [[DEST:%.*]], i8 -1, i32 1, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0.i32(ptr [[DEST:%.*]], i8 -1, i32 1, i1 false)
; CHECK-NEXT: br label [[BB:%.*]]
; CHECK: bb:
-; CHECK-NEXT: [[TMP1:%.*]] = icmp ne i8* [[DEST]], null
+; CHECK-NEXT: [[TMP1:%.*]] = icmp ne ptr [[DEST]], null
; CHECK-NEXT: ret void
;
- call void @llvm.memset.p0i8.i32(i8* %dest, i8 255, i32 1, i1 false)
+ call void @llvm.memset.p0.i32(ptr %dest, i8 255, i32 1, i1 false)
br label %bb
bb:
- icmp ne i8* %dest, null
+ icmp ne ptr %dest, null
ret void
}
-define void @test7(i8* %dest, i8* %src, i32 %len) {
+define void @test7(ptr %dest, ptr %src, i32 %len) {
; CHECK-LABEL: @test7(
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[DEST:%.*]], i8* [[SRC:%.*]], i32 [[LEN:%.*]], i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[DEST:%.*]], ptr [[SRC:%.*]], i32 [[LEN:%.*]], i1 false)
; CHECK-NEXT: br label [[BB:%.*]]
; CHECK: bb:
-; CHECK-NEXT: [[KEEP1:%.*]] = icmp ne i8* [[DEST]], null
-; CHECK-NEXT: [[KEEP2:%.*]] = icmp ne i8* [[SRC]], null
+; CHECK-NEXT: [[KEEP1:%.*]] = icmp ne ptr [[DEST]], null
+; CHECK-NEXT: [[KEEP2:%.*]] = icmp ne ptr [[SRC]], null
; CHECK-NEXT: ret void
;
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 %len, i1 false)
+ call void @llvm.memcpy.p0.p0.i32(ptr %dest, ptr %src, i32 %len, i1 false)
br label %bb
bb:
- %KEEP1 = icmp ne i8* %dest, null
- %KEEP2 = icmp ne i8* %src, null
+ %KEEP1 = icmp ne ptr %dest, null
+ %KEEP2 = icmp ne ptr %src, null
ret void
}
-declare void @llvm.memcpy.p1i8.p1i8.i32(i8 addrspace(1) *, i8 addrspace(1) *, i32, i1)
-define void @test8(i8 addrspace(1) * %dest, i8 addrspace(1) * %src) {
+declare void @llvm.memcpy.p1.p1.i32(ptr addrspace(1), ptr addrspace(1), i32, i1)
+define void @test8(ptr addrspace(1) %dest, ptr addrspace(1) %src) {
; CHECK-LABEL: @test8(
-; CHECK-NEXT: call void @llvm.memcpy.p1i8.p1i8.i32(i8 addrspace(1)* [[DEST:%.*]], i8 addrspace(1)* [[SRC:%.*]], i32 1, i1 false)
+; CHECK-NEXT: call void @llvm.memcpy.p1.p1.i32(ptr addrspace(1) [[DEST:%.*]], ptr addrspace(1) [[SRC:%.*]], i32 1, i1 false)
; CHECK-NEXT: br label [[BB:%.*]]
; CHECK: bb:
-; CHECK-NEXT: [[KEEP1:%.*]] = icmp ne i8 addrspace(1)* [[DEST]], null
-; CHECK-NEXT: [[KEEP2:%.*]] = icmp ne i8 addrspace(1)* [[SRC]], null
+; CHECK-NEXT: [[KEEP1:%.*]] = icmp ne ptr addrspace(1) [[DEST]], null
+; CHECK-NEXT: [[KEEP2:%.*]] = icmp ne ptr addrspace(1) [[SRC]], null
; CHECK-NEXT: ret void
;
- call void @llvm.memcpy.p1i8.p1i8.i32(i8 addrspace(1) * %dest, i8 addrspace(1) * %src, i32 1, i1 false)
+ call void @llvm.memcpy.p1.p1.i32(ptr addrspace(1) %dest, ptr addrspace(1) %src, i32 1, i1 false)
br label %bb
bb:
- %KEEP1 = icmp ne i8 addrspace(1) * %dest, null
- %KEEP2 = icmp ne i8 addrspace(1) * %src, null
+ %KEEP1 = icmp ne ptr addrspace(1) %dest, null
+ %KEEP2 = icmp ne ptr addrspace(1) %src, null
ret void
}
-define void @test9(i8* %dest, i8* %src) {
+define void @test9(ptr %dest, ptr %src) {
; CHECK-LABEL: @test9(
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[DEST:%.*]], i8* [[SRC:%.*]], i32 1, i1 true)
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr [[DEST:%.*]], ptr [[SRC:%.*]], i32 1, i1 true)
; CHECK-NEXT: br label [[BB:%.*]]
; CHECK: bb:
-; CHECK-NEXT: [[KEEP1:%.*]] = icmp ne i8* [[DEST]], null
-; CHECK-NEXT: [[KEEP2:%.*]] = icmp ne i8* [[SRC]], null
+; CHECK-NEXT: [[KEEP1:%.*]] = icmp ne ptr [[DEST]], null
+; CHECK-NEXT: [[KEEP2:%.*]] = icmp ne ptr [[SRC]], null
; CHECK-NEXT: ret void
;
- call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 1, i1 true)
+ call void @llvm.memcpy.p0.p0.i32(ptr %dest, ptr %src, i32 1, i1 true)
br label %bb
bb:
- %KEEP1 = icmp ne i8* %dest, null
- %KEEP2 = icmp ne i8* %src, null
+ %KEEP1 = icmp ne ptr %dest, null
+ %KEEP2 = icmp ne ptr %src, null
ret void
}
-declare void @test10_helper(i8* %arg1, i8* %arg2, i32 %non-pointer-arg)
+declare void @test10_helper(ptr %arg1, ptr %arg2, i32 %non-pointer-arg)
-define void @test10(i8* %arg1, i8* %arg2, i32 %non-pointer-arg) {
+define void @test10(ptr %arg1, ptr %arg2, i32 %non-pointer-arg) {
; CHECK-LABEL: @test10(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[IS_NULL:%.*]] = icmp eq i8* [[ARG1:%.*]], null
+; CHECK-NEXT: [[IS_NULL:%.*]] = icmp eq ptr [[ARG1:%.*]], null
; CHECK-NEXT: br i1 [[IS_NULL]], label [[NULL:%.*]], label [[NON_NULL:%.*]]
; CHECK: non_null:
-; CHECK-NEXT: call void @test10_helper(i8* nonnull [[ARG1]], i8* [[ARG2:%.*]], i32 [[NON_POINTER_ARG:%.*]])
+; CHECK-NEXT: call void @test10_helper(ptr nonnull [[ARG1]], ptr [[ARG2:%.*]], i32 [[NON_POINTER_ARG:%.*]])
; CHECK-NEXT: br label [[NULL]]
; CHECK: null:
-; CHECK-NEXT: call void @test10_helper(i8* [[ARG1]], i8* [[ARG2]], i32 [[NON_POINTER_ARG]])
+; CHECK-NEXT: call void @test10_helper(ptr [[ARG1]], ptr [[ARG2]], i32 [[NON_POINTER_ARG]])
; CHECK-NEXT: ret void
;
entry:
- %is_null = icmp eq i8* %arg1, null
+ %is_null = icmp eq ptr %arg1, null
br i1 %is_null, label %null, label %non_null
non_null:
- call void @test10_helper(i8* %arg1, i8* %arg2, i32 %non-pointer-arg)
+ call void @test10_helper(ptr %arg1, ptr %arg2, i32 %non-pointer-arg)
br label %null
null:
- call void @test10_helper(i8* %arg1, i8* %arg2, i32 %non-pointer-arg)
+ call void @test10_helper(ptr %arg1, ptr %arg2, i32 %non-pointer-arg)
ret void
}
-declare void @test11_helper(i8* %arg)
+declare void @test11_helper(ptr %arg)
-define void @test11(i8* %arg1, i8** %arg2) {
+define void @test11(ptr %arg1, ptr %arg2) {
; CHECK-LABEL: @test11(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[IS_NULL:%.*]] = icmp eq i8* [[ARG1:%.*]], null
+; CHECK-NEXT: [[IS_NULL:%.*]] = icmp eq ptr [[ARG1:%.*]], null
; CHECK-NEXT: br i1 [[IS_NULL]], label [[NULL:%.*]], label [[NON_NULL:%.*]]
; CHECK: non_null:
; CHECK-NEXT: br label [[MERGE:%.*]]
; CHECK-NEXT: [[ANOTHER_ARG:%.*]] = alloca i8, align 1
; CHECK-NEXT: br label [[MERGE]]
; CHECK: merge:
-; CHECK-NEXT: [[MERGED_ARG:%.*]] = phi i8* [ [[ANOTHER_ARG]], [[NULL]] ], [ [[ARG1]], [[NON_NULL]] ]
-; CHECK-NEXT: call void @test11_helper(i8* nonnull [[MERGED_ARG]])
+; CHECK-NEXT: [[MERGED_ARG:%.*]] = phi ptr [ [[ANOTHER_ARG]], [[NULL]] ], [ [[ARG1]], [[NON_NULL]] ]
+; CHECK-NEXT: call void @test11_helper(ptr nonnull [[MERGED_ARG]])
; CHECK-NEXT: ret void
;
entry:
- %is_null = icmp eq i8* %arg1, null
+ %is_null = icmp eq ptr %arg1, null
br i1 %is_null, label %null, label %non_null
non_null:
br label %merge
merge:
- %merged_arg = phi i8* [%another_arg, %null], [%arg1, %non_null]
- call void @test11_helper(i8* %merged_arg)
+ %merged_arg = phi ptr [%another_arg, %null], [%arg1, %non_null]
+ call void @test11_helper(ptr %merged_arg)
ret void
}
-declare void @test12_helper(i8* %arg)
+declare void @test12_helper(ptr %arg)
-define void @test12(i8* %arg1, i8** %arg2) {
+define void @test12(ptr %arg1, ptr %arg2) {
; CHECK-LABEL: @test12(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[IS_NULL:%.*]] = icmp eq i8* [[ARG1:%.*]], null
+; CHECK-NEXT: [[IS_NULL:%.*]] = icmp eq ptr [[ARG1:%.*]], null
; CHECK-NEXT: br i1 [[IS_NULL]], label [[NULL:%.*]], label [[NON_NULL:%.*]]
; CHECK: non_null:
; CHECK-NEXT: br label [[MERGE:%.*]]
; CHECK: null:
-; CHECK-NEXT: [[ANOTHER_ARG:%.*]] = load i8*, i8** [[ARG2:%.*]], align 8, !nonnull !0
+; CHECK-NEXT: [[ANOTHER_ARG:%.*]] = load ptr, ptr [[ARG2:%.*]], align 8, !nonnull !0
; CHECK-NEXT: br label [[MERGE]]
; CHECK: merge:
-; CHECK-NEXT: [[MERGED_ARG:%.*]] = phi i8* [ [[ANOTHER_ARG]], [[NULL]] ], [ [[ARG1]], [[NON_NULL]] ]
-; CHECK-NEXT: call void @test12_helper(i8* nonnull [[MERGED_ARG]])
+; CHECK-NEXT: [[MERGED_ARG:%.*]] = phi ptr [ [[ANOTHER_ARG]], [[NULL]] ], [ [[ARG1]], [[NON_NULL]] ]
+; CHECK-NEXT: call void @test12_helper(ptr nonnull [[MERGED_ARG]])
; CHECK-NEXT: ret void
;
entry:
- %is_null = icmp eq i8* %arg1, null
+ %is_null = icmp eq ptr %arg1, null
br i1 %is_null, label %null, label %non_null
non_null:
br label %merge
null:
- %another_arg = load i8*, i8** %arg2, !nonnull !{}
+ %another_arg = load ptr, ptr %arg2, !nonnull !{}
br label %merge
merge:
- %merged_arg = phi i8* [%another_arg, %null], [%arg1, %non_null]
- call void @test12_helper(i8* %merged_arg)
+ %merged_arg = phi ptr [%another_arg, %null], [%arg1, %non_null]
+ call void @test12_helper(ptr %merged_arg)
ret void
}
-define i1 @test_store_same_block(i8* %arg) {
+define i1 @test_store_same_block(ptr %arg) {
; CHECK-LABEL: @test_store_same_block(
-; CHECK-NEXT: store i8 0, i8* [[ARG:%.*]], align 1
-; CHECK-NEXT: [[CMP:%.*]] = icmp ne i8* [[ARG]], null
+; CHECK-NEXT: store i8 0, ptr [[ARG:%.*]], align 1
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr [[ARG]], null
; CHECK-NEXT: ret i1 true
;
- store i8 0, i8* %arg
- %cmp = icmp ne i8* %arg, null
+ store i8 0, ptr %arg
+ %cmp = icmp ne ptr %arg, null
ret i1 %cmp
}
; Check that nonnull metadata for non-dominating loads is not propagated.
; CHECK-LABEL: @test1(
; CHECK-LABEL: if.end:
-; CHECK: %[[ptr:.*]] = phi i32**
-; CHECK: %[[load:.*]] = load i32*, i32** %[[ptr]]
+; CHECK: %[[ptr:.*]] = phi ptr
+; CHECK: %[[load:.*]] = load ptr, ptr %[[ptr]]
; CHECK-NOT: !nonnull
-; CHECK: ret i32* %[[load]]
-define i32* @test1(i1 zeroext %flag, i32*** %p) {
+; CHECK: ret ptr %[[load]]
+define ptr @test1(i1 zeroext %flag, ptr %p) {
entry:
br i1 %flag, label %if.then, label %if.else
if.then:
- %a = load i32**, i32*** %p
- %aa = load i32*, i32** %a, !nonnull !0
+ %a = load ptr, ptr %p
+ %aa = load ptr, ptr %a, !nonnull !0
br label %if.end
if.else:
- %b = load i32**, i32*** %p
- %bb= load i32*, i32** %b
+ %b = load ptr, ptr %p
+ %bb= load ptr, ptr %b
br label %if.end
if.end:
- %c = phi i32* [ %aa, %if.then ], [ %bb, %if.else ]
- ret i32* %c
+ %c = phi ptr [ %aa, %if.then ], [ %bb, %if.else ]
+ ret ptr %c
}
; CHECK-LABEL: @test2(
; CHECK-LABEL: if.end:
-; CHECK: %[[ptr:.*]] = phi i32**
-; CHECK: %[[load:.*]] = load i32*, i32** %[[ptr]]
+; CHECK: %[[ptr:.*]] = phi ptr
+; CHECK: %[[load:.*]] = load ptr, ptr %[[ptr]]
; CHECK-NOT: !nonnull
-; CHECK: ret i32* %[[load]]
-define i32* @test2(i1 zeroext %flag, i32*** %p) {
+; CHECK: ret ptr %[[load]]
+define ptr @test2(i1 zeroext %flag, ptr %p) {
entry:
br i1 %flag, label %if.then, label %if.else
if.then:
- %a = load i32**, i32*** %p
- %aa = load i32*, i32** %a
+ %a = load ptr, ptr %p
+ %aa = load ptr, ptr %a
br label %if.end
if.else:
- %b = load i32**, i32*** %p
- %bb= load i32*, i32** %b, !nonnull !0
+ %b = load ptr, ptr %p
+ %bb= load ptr, ptr %b, !nonnull !0
br label %if.end
if.end:
- %c = phi i32* [ %aa, %if.then ], [ %bb, %if.else ]
- ret i32* %c
+ %c = phi ptr [ %aa, %if.then ], [ %bb, %if.else ]
+ ret ptr %c
}
; CHECK: load i32
; CHECK: store <2 x i32>
; CHECK: load i32
-define void @interleave_2L_2S(i32* noalias %ptr) {
- %next.gep = getelementptr i32, i32* %ptr, i64 0
- %next.gep1 = getelementptr i32, i32* %ptr, i64 1
- %next.gep2 = getelementptr i32, i32* %ptr, i64 2
-
- %l1 = load i32, i32* %next.gep1, align 4
- %l2 = load i32, i32* %next.gep, align 4
- store i32 0, i32* %next.gep1, align 4
- store i32 0, i32* %next.gep, align 4
- %l3 = load i32, i32* %next.gep1, align 4
- %l4 = load i32, i32* %next.gep2, align 4
+define void @interleave_2L_2S(ptr noalias %ptr) {
+ %next.gep1 = getelementptr i32, ptr %ptr, i64 1
+ %next.gep2 = getelementptr i32, ptr %ptr, i64 2
+
+ %l1 = load i32, ptr %next.gep1, align 4
+ %l2 = load i32, ptr %ptr, align 4
+ store i32 0, ptr %next.gep1, align 4
+ store i32 0, ptr %ptr, align 4
+ %l3 = load i32, ptr %next.gep1, align 4
+ %l4 = load i32, ptr %next.gep2, align 4
ret void
}
; CHECK: store <2 x i32>
; CHECK: load i32
-define void @interleave_3L_2S_1L(i32* noalias %ptr) {
- %next.gep = getelementptr i32, i32* %ptr, i64 0
- %next.gep1 = getelementptr i32, i32* %ptr, i64 1
- %next.gep2 = getelementptr i32, i32* %ptr, i64 2
+define void @interleave_3L_2S_1L(ptr noalias %ptr) {
+ %next.gep1 = getelementptr i32, ptr %ptr, i64 1
+ %next.gep2 = getelementptr i32, ptr %ptr, i64 2
- %l2 = load i32, i32* %next.gep, align 4
- %l1 = load i32, i32* %next.gep1, align 4
- store i32 0, i32* %next.gep1, align 4
- store i32 0, i32* %next.gep, align 4
- %l3 = load i32, i32* %next.gep1, align 4
- %l4 = load i32, i32* %next.gep2, align 4
+ %l2 = load i32, ptr %ptr, align 4
+ %l1 = load i32, ptr %next.gep1, align 4
+ store i32 0, ptr %next.gep1, align 4
+ store i32 0, ptr %ptr, align 4
+ %l3 = load i32, ptr %next.gep1, align 4
+ %l4 = load i32, ptr %next.gep2, align 4
ret void
}
; CHECK: load i32
; CHECK: store <2 x i32>
; CHECK: load <2 x i32>
-define void @chain_suffix(i32* noalias %ptr) {
- %next.gep = getelementptr i32, i32* %ptr, i64 0
- %next.gep1 = getelementptr i32, i32* %ptr, i64 1
- %next.gep2 = getelementptr i32, i32* %ptr, i64 2
+define void @chain_suffix(ptr noalias %ptr) {
+ %next.gep1 = getelementptr i32, ptr %ptr, i64 1
+ %next.gep2 = getelementptr i32, ptr %ptr, i64 2
- %l2 = load i32, i32* %next.gep, align 4
- store i32 0, i32* %next.gep1, align 4
- store i32 0, i32* %next.gep, align 4
- %l3 = load i32, i32* %next.gep1, align 4
- %l4 = load i32, i32* %next.gep2, align 4
+ %l2 = load i32, ptr %ptr, align 4
+ store i32 0, ptr %next.gep1, align 4
+ store i32 0, ptr %ptr, align 4
+ %l3 = load i32, ptr %next.gep1, align 4
+ %l4 = load i32, ptr %next.gep2, align 4
ret void
}
; CHECK: load <2 x i32>
; CHECK: store <2 x i32>
; CHECK: load <3 x i32>
-define void @chain_prefix_suffix(i32* noalias %ptr) {
- %next.gep = getelementptr i32, i32* %ptr, i64 0
- %next.gep1 = getelementptr i32, i32* %ptr, i64 1
- %next.gep2 = getelementptr i32, i32* %ptr, i64 2
- %next.gep3 = getelementptr i32, i32* %ptr, i64 3
-
- %l1 = load i32, i32* %next.gep, align 4
- %l2 = load i32, i32* %next.gep1, align 4
- store i32 0, i32* %next.gep1, align 4
- store i32 0, i32* %next.gep2, align 4
- %l3 = load i32, i32* %next.gep1, align 4
- %l4 = load i32, i32* %next.gep2, align 4
- %l5 = load i32, i32* %next.gep3, align 4
+define void @chain_prefix_suffix(ptr noalias %ptr) {
+ %next.gep1 = getelementptr i32, ptr %ptr, i64 1
+ %next.gep2 = getelementptr i32, ptr %ptr, i64 2
+ %next.gep3 = getelementptr i32, ptr %ptr, i64 3
+
+ %l1 = load i32, ptr %ptr, align 4
+ %l2 = load i32, ptr %next.gep1, align 4
+ store i32 0, ptr %next.gep1, align 4
+ store i32 0, ptr %next.gep2, align 4
+ %l3 = load i32, ptr %next.gep1, align 4
+ %l4 = load i32, ptr %next.gep2, align 4
+ %l5 = load i32, ptr %next.gep3, align 4
ret void
}
; CHECK: load i32
; CHECK: load i32
-define void @interleave_get_longest(i32* noalias %ptr) {
- %tmp1 = getelementptr i32, i32* %ptr, i64 0
- %tmp2 = getelementptr i32, i32* %ptr, i64 1
- %tmp3 = getelementptr i32, i32* %ptr, i64 2
- %tmp4 = getelementptr i32, i32* %ptr, i64 3
-
- %l1 = load i32, i32* %tmp2, align 4
- %l2 = load i32, i32* %tmp1, align 4
- store i32 0, i32* %tmp2, align 4
- store i32 0, i32* %tmp1, align 4
- %l3 = load i32, i32* %tmp2, align 4
- %l4 = load i32, i32* %tmp3, align 4
- %l5 = load i32, i32* %tmp4, align 4
- %l6 = load i32, i32* %tmp4, align 4
- %l7 = load i32, i32* %tmp4, align 4
+define void @interleave_get_longest(ptr noalias %ptr) {
+ %tmp2 = getelementptr i32, ptr %ptr, i64 1
+ %tmp3 = getelementptr i32, ptr %ptr, i64 2
+ %tmp4 = getelementptr i32, ptr %ptr, i64 3
+
+ %l1 = load i32, ptr %tmp2, align 4
+ %l2 = load i32, ptr %ptr, align 4
+ store i32 0, ptr %tmp2, align 4
+ store i32 0, ptr %ptr, align 4
+ %l3 = load i32, ptr %tmp2, align 4
+ %l4 = load i32, ptr %tmp3, align 4
+ %l5 = load i32, ptr %tmp4, align 4
+ %l6 = load i32, ptr %tmp4, align 4
+ %l7 = load i32, ptr %tmp4, align 4
ret void
}
;
; TODO: this case doesn't trigger yet.
;
-define dso_local void @v0(i32 %n, i32* nocapture %A, i32* nocapture readonly %B) local_unnamed_addr #0 {
+define dso_local void @v0(i32 %n, ptr nocapture %A, ptr nocapture readonly %B) local_unnamed_addr #0 {
;
; CHECK-LABEL: @v0
; CHECK-NOT: %flatten.tripcount = mul i32 %n, %n
for.body4.us:
%k.119.us = phi i32 [ %k.022.us, %for.cond1.preheader.us ], [ %inc.us, %for.body4.us ]
- %arrayidx.us = getelementptr inbounds i32, i32* %B, i32 %k.119.us
- %1 = load i32, i32* %arrayidx.us, align 4
- %arrayidx5.us = getelementptr inbounds i32, i32* %A, i32 %k.119.us
- store i32 %1, i32* %arrayidx5.us, align 4
+ %arrayidx.us = getelementptr inbounds i32, ptr %B, i32 %k.119.us
+ %1 = load i32, ptr %arrayidx.us, align 4
+ %arrayidx5.us = getelementptr inbounds i32, ptr %A, i32 %k.119.us
+ store i32 %1, ptr %arrayidx5.us, align 4
%inc.us = add i32 %k.119.us, 1
%exitcond = icmp ne i32 %inc.us, %0
br i1 %exitcond, label %for.body4.us, label %for.cond1.for.cond.cleanup3_crit_edge.us
; k++;
; }
;
-define dso_local void @v1(i32 %n, i32* nocapture %A, i32* nocapture readonly %B) local_unnamed_addr #0 {
+define dso_local void @v1(i32 %n, ptr nocapture %A, ptr nocapture readonly %B) local_unnamed_addr #0 {
;
; CHECK-LABEL: @v1
; CHECK: for.cond1.preheader.us.preheader:
for.body4.us:
%j.022.us = phi i32 [ 0, %for.cond1.preheader.us ], [ %inc6.us, %for.body4.us ]
%add.us = add nsw i32 %j.022.us, %mul.us
- %arrayidx.us = getelementptr inbounds i32, i32* %B, i32 %add.us
- %0 = load i32, i32* %arrayidx.us, align 4
- %arrayidx5.us = getelementptr inbounds i32, i32* %A, i32 %add.us
- store i32 %0, i32* %arrayidx5.us, align 4
+ %arrayidx.us = getelementptr inbounds i32, ptr %B, i32 %add.us
+ %0 = load i32, ptr %arrayidx.us, align 4
+ %arrayidx5.us = getelementptr inbounds i32, ptr %A, i32 %add.us
+ store i32 %0, ptr %arrayidx5.us, align 4
%inc6.us = add nuw nsw i32 %j.022.us, 1
%exitcond = icmp ne i32 %inc6.us, %n
br i1 %exitcond, label %for.body4.us, label %for.cond1.for.cond.cleanup3_crit_edge.us
;
; Make sure two incomplete phis will not be marked as congruent.
;
-; CHECK: One incomplete PHI is found: %[[IV:.*]] = phi [0 x %0]*
-; CHECK: One incomplete PHI is found: %[[IV2:.*]] = phi [0 x %0]*
+; CHECK: One incomplete PHI is found: %[[IV:.*]] = phi ptr
+; CHECK: One incomplete PHI is found: %[[IV2:.*]] = phi ptr
; CHECK-NOT: Eliminated congruent iv: %[[IV]]
; CHECK-NOT: Original iv: %[[IV2]]
; CHECK-NOT: Eliminated congruent iv: %[[IV2]]
%0 = type <{ float }>
-define void @foo([0 x %0]* %arg) {
+define void @foo(ptr %arg) {
bb:
- %i = getelementptr inbounds [0 x %0], [0 x %0]* %arg, i64 0, i64 -1
- %i1 = bitcast %0* %i to i8*
- %i2 = getelementptr i8, i8* %i1, i64 4
+ %i = getelementptr inbounds [0 x %0], ptr %arg, i64 0, i64 -1
+ %i2 = getelementptr i8, ptr %i, i64 4
br label %bb3
bb3: ; preds = %bb18, %bb
%i10 = phi i64 [ 0, %bb3 ], [ %i16, %bb9 ]
%i11 = add i64 %i10, %i4
%i12 = shl i64 %i11, 2
- %i13 = getelementptr i8, i8* %i2, i64 %i12
- %i14 = bitcast i8* %i13 to float*
- %i15 = bitcast float* %i14 to <4 x float>*
- store <4 x float> undef, <4 x float>* %i15, align 4
+ %i13 = getelementptr i8, ptr %i2, i64 %i12
+ store <4 x float> undef, ptr %i13, align 4
%i16 = add i64 %i10, 32
br i1 true, label %bb17, label %bb9
bb22: ; preds = %bb22, %bb17, %bb3
%i23 = phi i64 [ %i26, %bb22 ], [ undef, %bb17 ], [ 100, %bb3 ]
%i24 = add nsw i64 %i23, %i4
- %i25 = getelementptr %0, %0* %i, i64 %i24, i32 0
- store float undef, float* %i25, align 4
+ %i25 = getelementptr %0, ptr %i, i64 %i24, i32 0
+ store float undef, ptr %i25, align 4
%i26 = add nuw nsw i64 %i23, 1
br label %bb22
}
; for (int i = 0; i < numIterations; ++i)
; sum += ptr[i + offset];
;
-define float @testadd(float* %input, i32 %offset, i32 %numIterations) {
+define float @testadd(ptr %input, i32 %offset, i32 %numIterations) {
; CHECK-LABEL: @testadd
; CHECK: sext i32 %offset to i64
; CHECK: loop:
-; CHECK-DAG: phi float*
+; CHECK-DAG: phi ptr
; CHECK-DAG: phi i32
; CHECK-NOT: sext
%sum = phi float [ %nextsum, %loop ], [ 0.000000e+00, %entry ]
%index32 = add nuw nsw i32 %i, %offset
%index64 = sext i32 %index32 to i64
- %ptr = getelementptr inbounds float, float* %input, i64 %index64
- %addend = load float, float* %ptr, align 4
+ %ptr = getelementptr inbounds float, ptr %input, i64 %index64
+ %addend = load float, ptr %ptr, align 4
%nextsum = fadd float %sum, %addend
%nexti = add nuw nsw i32 %i, 1
%exitcond = icmp eq i32 %nexti, %numIterations
; for (int i = 0; i < numIterations; ++i)
; sum += ptr[i - offset];
;
-define float @testsub(float* %input, i32 %offset, i32 %numIterations) {
+define float @testsub(ptr %input, i32 %offset, i32 %numIterations) {
; CHECK-LABEL: @testsub
; CHECK: sext i32 %offset to i64
; CHECK: loop:
-; CHECK-DAG: phi float*
+; CHECK-DAG: phi ptr
; CHECK-DAG: phi i32
; CHECK-NOT: sext
%sum = phi float [ %nextsum, %loop ], [ 0.000000e+00, %entry ]
%index32 = sub nuw nsw i32 %i, %offset
%index64 = sext i32 %index32 to i64
- %ptr = getelementptr inbounds float, float* %input, i64 %index64
- %addend = load float, float* %ptr, align 4
+ %ptr = getelementptr inbounds float, ptr %input, i64 %index64
+ %addend = load float, ptr %ptr, align 4
%nextsum = fadd float %sum, %addend
%nexti = add nuw nsw i32 %i, 1
%exitcond = icmp eq i32 %nexti, %numIterations
; for (int i = 0; i < numIterations; ++i)
; sum += ptr[i * stride];
;
-define float @testmul(float* %input, i32 %stride, i32 %numIterations) {
+define float @testmul(ptr %input, i32 %stride, i32 %numIterations) {
; CHECK-LABEL: @testmul
; CHECK: sext i32 %stride to i64
; CHECK: loop:
-; CHECK-DAG: phi float*
+; CHECK-DAG: phi ptr
; CHECK-DAG: phi i32
; CHECK-NOT: sext
%sum = phi float [ %nextsum, %loop ], [ 0.000000e+00, %entry ]
%index32 = mul nuw nsw i32 %i, %stride
%index64 = sext i32 %index32 to i64
- %ptr = getelementptr inbounds float, float* %input, i64 %index64
- %addend = load float, float* %ptr, align 4
+ %ptr = getelementptr inbounds float, ptr %input, i64 %index64
+ %addend = load float, ptr %ptr, align 4
%nextsum = fadd float %sum, %addend
%nexti = add nuw nsw i32 %i, 1
%exitcond = icmp eq i32 %nexti, %numIterations
;
; The multiplication by 3 is to make the address calculation expensive
; enough to force the introduction of a pointer induction variable.
-define float @testshl(float* %input, i32 %numIterations) {
+define float @testshl(ptr %input, i32 %numIterations) {
; CHECK-LABEL: @testshl
; CHECK: loop:
-; CHECK-DAG: phi float*
+; CHECK-DAG: phi ptr
; CHECK-DAG: phi i32
; CHECK-NOT: sext
%index32 = shl nuw nsw i32 %i, 7
%index32mul = mul nuw nsw i32 %index32, 3
%index64 = sext i32 %index32mul to i64
- %ptr = getelementptr inbounds float, float* %input, i64 %index64
- %addend = load float, float* %ptr, align 4
+ %ptr = getelementptr inbounds float, ptr %input, i64 %index64
+ %addend = load float, ptr %ptr, align 4
%nextsum = fadd float %sum, %addend
%nexti = add nuw nsw i32 %i, 1
%exitcond = icmp eq i32 %nexti, %numIterations
; Make sure LV legal bails out when the loop doesn't have a legal pre-header.
; CHECK-LABEL: 'inc'
; CHECK: LV: Not vectorizing: Loop doesn't have a legal pre-header.
-define void @inc(i32 %n, i8* %P) {
+define void @inc(i32 %n, ptr %P) {
%1 = icmp sgt i32 %n, 0
br i1 %1, label %BB1, label %BB2
BB1:
- indirectbr i8* %P, [label %.lr.ph]
+ indirectbr ptr %P, [label %.lr.ph]
BB2:
br label %.lr.ph
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1"
target triple = "x86_64-unknown-linux-gnu"
-define void @testGuardedInnerLoop(i32* %ptr, i32 %denom, i32 %numer, i32 %outer_lim) {
+define void @testGuardedInnerLoop(ptr %ptr, i32 %denom, i32 %numer, i32 %outer_lim) {
entry:
%cmp1 = icmp eq i32 %outer_lim, 0
br i1 %cmp1, label %exit, label %loop1.preheader
loop2:
%indvar.loop2 = phi i64 [ 0, %loop2.preheader ], [ %indvar.loop2.next, %loop2 ]
- %arrayidx = getelementptr inbounds i32, i32* %ptr, i64 %indvar.loop2
- store i32 1, i32* %arrayidx, align 4
+ %arrayidx = getelementptr inbounds i32, ptr %ptr, i64 %indvar.loop2
+ store i32 1, ptr %arrayidx, align 4
%indvar.loop2.next = add nuw nsw i64 %indvar.loop2, 1
%cmp2 = icmp ult i64 %indvar.loop2.next, %2
br i1 %cmp2, label %loop2, label %loop2.exit
; Verify that a 'udiv' does not appear in the 'loop1.preheader' block, and that
; a 'udiv' has been inserted at the top of the 'while.body.preheader' block.
-define void @testCountIncrLoop(i8* %ptr, i32 %lim, i32 %count, i32 %val) mustprogress {
+define void @testCountIncrLoop(ptr %ptr, i32 %lim, i32 %count, i32 %val) mustprogress {
; CHECK-LABEL: @testCountIncrLoop(
; CHECK-NEXT: entry:
; CHECK: loop1.preheader:
%conv = trunc i32 %result.0.lcssa to i8
%inc = add nsw i32 %inx.1, 1
%idxprom = sext i32 %inx.1 to i64
- %arrayidx = getelementptr inbounds i8, i8* %ptr, i64 %idxprom
- store i8 %conv, i8* %arrayidx, align 1
+ %arrayidx = getelementptr inbounds i8, ptr %ptr, i64 %idxprom
+ store i8 %conv, ptr %arrayidx, align 1
br label %loop1.inc
loop1.inc: ; preds = %while.end, %loop1.body
; division from the inner loop to the preheader.
;
; Verify that the 'udiv' is hoisted to the preheader, and is not in the loop body.
-define i32 @NonZeroDivHoist(i32* nocapture readonly %ptr, i32 %start1, i32 %start2) {
+define i32 @NonZeroDivHoist(ptr nocapture readonly %ptr, i32 %start1, i32 %start2) {
; INDVARCHECK-LABEL: @NonZeroDivHoist(
; INDVARCHECK-NEXT: entry:
; INDVARCHECK: for.body3.lr.ph:
br i1 %cmp, label %for.body, label %for.end10
for.body: ; preds = %for.cond
- %tmp = load i32, i32* %ptr, align 4
+ %tmp = load i32, ptr %ptr, align 4
%add = add i32 %tmp, %val.0
%cmp224 = icmp ult i32 %start2, 10
br i1 %cmp224, label %for.body3.lr.ph, label %for.end
%div = udiv i32 16, %counter1.0
%add4 = add i32 %div, %index.027
%idxprom5 = zext i32 %add4 to i64
- %arrayidx6 = getelementptr inbounds i32, i32* %ptr, i64 %idxprom5
- %tmp1 = load i32, i32* %arrayidx6, align 4
+ %arrayidx6 = getelementptr inbounds i32, ptr %ptr, i64 %idxprom5
+ %tmp1 = load i32, ptr %arrayidx6, align 4
%add7 = add i32 %tmp1, %val.126
%inc = add i32 %counter2.025, 1
%cmp2 = icmp ult i32 %inc, 10
;
; Verify that the 'udiv' is not hoisted to the preheader, and it remains in the
; loop body.
-define i32 @ZeroDivNoHoist(i32* nocapture readonly %ptr, i32 %start1, i32 %start2) {
+define i32 @ZeroDivNoHoist(ptr nocapture readonly %ptr, i32 %start1, i32 %start2) {
; INDVARCHECK-LABEL: @ZeroDivNoHoist(
; INDVARCHECK-NEXT: entry:
; INDVARCHECK-NOT: udiv
br i1 %cmp, label %for.body, label %for.end10
for.body: ; preds = %for.cond
- %tmp = load i32, i32* %ptr, align 4
+ %tmp = load i32, ptr %ptr, align 4
%add = add i32 %tmp, %val.0
%cmp224 = icmp ult i32 %start2, 10
br i1 %cmp224, label %for.body3.lr.ph, label %for.end
%div = udiv i32 16, %counter1.0
%add4 = add i32 %div, %index.027
%idxprom5 = zext i32 %add4 to i64
- %arrayidx6 = getelementptr inbounds i32, i32* %ptr, i64 %idxprom5
- %tmp1 = load i32, i32* %arrayidx6, align 4
+ %arrayidx6 = getelementptr inbounds i32, ptr %ptr, i64 %idxprom5
+ %tmp1 = load i32, ptr %arrayidx6, align 4
%add7 = add i32 %tmp1, %val.126
%inc = add i32 %counter2.025, 1
%cmp2 = icmp ult i32 %inc, 10
;
; Verify that the division-operation is hoisted, and that it appears as a
; right-shift ('lshr') rather than an explicit division.
-define i32 @DivBy16Hoist(i32* nocapture readonly %ptr, i32 %start1, i32 %start2) {
+define i32 @DivBy16Hoist(ptr nocapture readonly %ptr, i32 %start1, i32 %start2) {
; INDVARCHECK-LABEL: @DivBy16Hoist(
; INDVARCHECK-NEXT: entry:
; INDVARCHECK: for.cond:
br i1 %cmp, label %for.body, label %for.end10
for.body: ; preds = %for.cond
- %tmp = load i32, i32* %ptr, align 4
+ %tmp = load i32, ptr %ptr, align 4
%add = add i32 %tmp, %val.0
%cmp224 = icmp ult i32 %start2, 10
br i1 %cmp224, label %for.body3.lr.ph, label %for.end
%div = udiv i32 %counter1.0, 16
%add4 = add i32 %div, %index.027
%idxprom5 = zext i32 %add4 to i64
- %arrayidx6 = getelementptr inbounds i32, i32* %ptr, i64 %idxprom5
- %tmp1 = load i32, i32* %arrayidx6, align 4
+ %arrayidx6 = getelementptr inbounds i32, ptr %ptr, i64 %idxprom5
+ %tmp1 = load i32, ptr %arrayidx6, align 4
%add7 = add i32 %tmp1, %val.126
%inc = add i32 %counter2.025, 1
%cmp2 = icmp ult i32 %inc, 10
; it remains a division, rather than being transformed to a right-shift.
;
; Verify that the division-operation is hoisted.
-define i32 @DivBy17Hoist(i32* nocapture readonly %ptr, i32 %start1, i32 %start2) {
+define i32 @DivBy17Hoist(ptr nocapture readonly %ptr, i32 %start1, i32 %start2) {
; INDVARCHECK-LABEL: @DivBy17Hoist(
; INDVARCHECK-NEXT: entry:
; INDVARCHECK: for.cond:
br i1 %cmp, label %for.body, label %for.end10
for.body: ; preds = %for.cond
- %tmp = load i32, i32* %ptr, align 4
+ %tmp = load i32, ptr %ptr, align 4
%add = add i32 %tmp, %val.0
%cmp224 = icmp ult i32 %start2, 10
br i1 %cmp224, label %for.body3.lr.ph, label %for.end
%div = udiv i32 %counter1.0, 17
%add4 = add i32 %div, %index.027
%idxprom5 = zext i32 %add4 to i64
- %arrayidx6 = getelementptr inbounds i32, i32* %ptr, i64 %idxprom5
- %tmp1 = load i32, i32* %arrayidx6, align 4
+ %arrayidx6 = getelementptr inbounds i32, ptr %ptr, i64 %idxprom5
+ %tmp1 = load i32, ptr %arrayidx6, align 4
%add7 = add i32 %tmp1, %val.126
%inc = add i32 %counter2.025, 1
%cmp2 = icmp ult i32 %inc, 10
; *ptr += val;
;}
-define void @foo(float* nocapture %ptr, float %val) local_unnamed_addr {
+define void @foo(ptr nocapture %ptr, float %val) local_unnamed_addr {
entry:
- %ptr.promoted = load float, float* %ptr, align 4
+ %ptr.promoted = load float, ptr %ptr, align 4
br label %for.body
for.body: ; preds = %entry, %for.body
br i1 %cmp, label %for.body, label %for.end
for.end: ; preds = %for.body
- store float %add, float* %ptr, align 4
+ store float %add, ptr %ptr, align 4
ret void
}