; generates a post loop, which should have metadata !llvm.loop !2
; Function Attrs: alwaysinline
-define void @inner_loop(i32* %arr, i32* %a_len_ptr, i32 %n) #0 {
+define void @inner_loop(ptr %arr, ptr %a_len_ptr, i32 %n) #0 {
; CHECK-LABEL: inner_loop(
; CHECK-LABEL: in.bounds.postloop
; CHECK: br i1 %next.postloop, label %loop.postloop, label %exit.loopexit.loopexit, !llvm.loop !2, !irce.loop.clone !7
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds: ; preds = %loop
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
}
; add loop metadata for pre and post loops
-define void @single_access_with_preloop(i32 *%arr, i32 *%a_len_ptr, i32 %n, i32 %offset) {
+define void @single_access_with_preloop(ptr %arr, ptr %a_len_ptr, i32 %n, i32 %offset) {
; CHECK-LABEL: @single_access_with_preloop(
; CHECK-LABEL: in.bounds.preloop
; CHECK: br i1 [[COND:%[^ ]+]], label %loop.preloop, label %preloop.exit.selector, !llvm.loop !8, !irce.loop.clone !7
; CHECK-LABEL: in.bounds.postloop
; CHECK: br i1 %next.postloop, label %loop.postloop, label %exit.loopexit.loopexit, !llvm.loop !9, !irce.loop.clone !7
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %array.idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %array.idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; safe to expand it to preheader: if we exit by maybe_exit condition, it is
; unsafe to execute it there.
-define void @test_02(i64* %p1, i64* %p2, i1 %maybe_exit) {
+define void @test_02(ptr %p1, ptr %p2, i1 %maybe_exit) {
; CHECK-LABEL: test_02
; CHECK-NOT: preloop
entry:
- %num = load i64, i64* %p1, align 4, !range !0
- %denom = load i64, i64* %p2, align 4, !range !0
+ %num = load i64, ptr %p1, align 4, !range !0
+ %denom = load i64, ptr %p2, align 4, !range !0
br label %loop
exit: ; preds = %guarded, %loop
br i1 %rc, label %guarded, label %exit
guarded:
- %gep = getelementptr i64, i64* %p1, i64 %iv.next
- %loaded = load i64, i64* %gep, align 4
+ %gep = getelementptr i64, ptr %p1, i64 %iv.next
+ %loaded = load i64, ptr %gep, align 4
%tmp7 = icmp slt i64 %iv.next, 1000
br i1 %tmp7, label %loop, label %exit
}
-define void @test_03(i64* %p1, i64* %p2, i1 %maybe_exit) {
+define void @test_03(ptr %p1, ptr %p2, i1 %maybe_exit) {
; Show that IRCE would hit test_02 if the division was safe (denom not zero).
; CHECK-LABEL: test_03
; CHECK: entry:
-; CHECK-NEXT: %num = load i64, i64* %p1, align 4
+; CHECK-NEXT: %num = load i64, ptr %p1, align 4
; CHECK-NEXT: [[DIV:%[^ ]+]] = udiv i64 %num, 13
; CHECK-NEXT: [[DIV_MINUS_1:%[^ ]+]] = add nsw i64 [[DIV]], -1
; CHECK-NEXT: %exit.mainloop.at = call i64 @llvm.smax.i64(i64 [[DIV_MINUS_1]], i64 0)
; CHECK-NEXT: %or.cond = select i1 %maybe_exit, i1 true, i1 false
; CHECK-NEXT: br i1 %or.cond, label %guarded, label %exit.loopexit1
; CHECK: guarded:
-; CHECK-NEXT: %gep = getelementptr i64, i64* %p1, i64 %iv.next
-; CHECK-NEXT: %loaded = load i64, i64* %gep, align 4
+; CHECK-NEXT: %gep = getelementptr i64, ptr %p1, i64 %iv.next
+; CHECK-NEXT: %loaded = load i64, ptr %gep, align 4
; CHECK-NEXT: %tmp7 = icmp slt i64 %iv.next, 1000
; CHECK-NEXT: [[EXIT_MAIN_LOOP:%[^ ]+]] = icmp slt i64 %iv.next, %exit.mainloop.at
; CHECK-NEXT: br i1 [[EXIT_MAIN_LOOP]], label %loop, label %main.exit.selector
; CHECK: postloop
entry:
- %num = load i64, i64* %p1, align 4, !range !0
+ %num = load i64, ptr %p1, align 4, !range !0
br label %loop
exit: ; preds = %guarded, %loop
br i1 %rc, label %guarded, label %exit
guarded:
- %gep = getelementptr i64, i64* %p1, i64 %iv.next
- %loaded = load i64, i64* %gep, align 4
+ %gep = getelementptr i64, ptr %p1, i64 %iv.next
+ %loaded = load i64, ptr %gep, align 4
%tmp7 = icmp slt i64 %iv.next, 1000
br i1 %tmp7, label %loop, label %exit
}
; CHECK-NOT: constrained loop
-define void @single_access_no_preloop_no_offset(i32 *%arr, i32 *%a_len_ptr, i32 %n) {
+define void @single_access_no_preloop_no_offset(ptr %arr, ptr %a_len_ptr, i32 %n) {
entry:
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
loop:
%idx = phi i32 [ 0, %entry ] , [ %idx.next, %in.bounds ]
%idx.next = add i32 %idx, 1
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%abc = icmp slt i32 %idx, %len
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
entry:
%indvars.iv.next467 = add nuw nsw i64 2, 1
- %length.i167 = load i32, i32 addrspace(1)* undef, align 8
+ %length.i167 = load i32, ptr addrspace(1) undef, align 8
%tmp21 = zext i32 %length.i167 to i64
- %tmp34 = load atomic i32, i32 addrspace(1)* undef unordered, align 4
+ %tmp34 = load atomic i32, ptr addrspace(1) undef unordered, align 4
%tmp35 = add i32 %tmp34, -9581
%tmp36 = icmp ugt i32 %length.i167, 1
br i1 %tmp36, label %preheader, label %exit
preheader: ; preds = %entry
; CHECK: preheader:
-; CHECK-NEXT: %length_gep.i146 = getelementptr inbounds i8, i8 addrspace(1)* undef, i64 8
-; CHECK-NEXT: %length_gep_typed.i147 = bitcast i8 addrspace(1)* undef to i32 addrspace(1)*
+; CHECK-NEXT: %length_gep.i146 = getelementptr inbounds i8, ptr addrspace(1) undef, i64 8
; CHECK-NEXT: %tmp43 = icmp ult i64 %indvars.iv.next467, %tmp21
; CHECK-NEXT: %exit.mainloop.at = call i64 @llvm.umax.i64(i64 %tmp21, i64 1)
; CHECK-NEXT: [[C1:%[^ ]+]] = icmp ult i64 1, %exit.mainloop.at
; CHECK-NEXT: br i1 [[C1]], label %loop.preheader, label %main.pseudo.exit
- %length_gep.i146 = getelementptr inbounds i8, i8 addrspace(1)* undef, i64 8
- %length_gep_typed.i147 = bitcast i8 addrspace(1)* undef to i32 addrspace(1)*
+ %length_gep.i146 = getelementptr inbounds i8, ptr addrspace(1) undef, i64 8
%tmp43 = icmp ult i64 %indvars.iv.next467, %tmp21
br label %loop
loop: ; preds = %not_zero, %preheader
%tmp62 = phi i32 [ 1, %preheader ], [ %tmp55, %not_zero ]
%indvars.iv750 = phi i64 [ 1, %preheader ], [ %indvars.iv.next, %not_zero ]
- %length.i148 = load i32, i32 addrspace(1)* %length_gep_typed.i147, align 8
+ %length.i148 = load i32, ptr addrspace(1) undef, align 8
%tmp68 = zext i32 %length.i148 to i64
%tmp97 = icmp ult i64 2, %tmp68
%or.cond = and i1 %tmp43, %tmp97
; RUN: opt -S -verify-loop-info -irce < %s | FileCheck %s
; RUN: opt -S -verify-loop-info -passes='require<branch-prob>,irce' < %s | FileCheck %s
-define void @f_0(i32 *%arr, i32 *%a_len_ptr, i32 %n, i1* %cond_buf) {
+define void @f_0(ptr %arr, ptr %a_len_ptr, i32 %n, ptr %cond_buf) {
; CHECK-LABEL: @f_0(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[LEN:%.*]] = load i32, i32* [[A_LEN_PTR:%.*]], align 4, !range [[RNG0:![0-9]+]]
+; CHECK-NEXT: [[LEN:%.*]] = load i32, ptr [[A_LEN_PTR:%.*]], align 4, !range [[RNG0:![0-9]+]]
; CHECK-NEXT: [[FIRST_ITR_CHECK:%.*]] = icmp sgt i32 [[N:%.*]], 0
; CHECK-NEXT: br i1 [[FIRST_ITR_CHECK]], label [[LOOP_PREHEADER:%.*]], label [[EXIT:%.*]]
; CHECK: loop.preheader:
; CHECK-NEXT: [[IDX_NEXT]] = add i32 [[IDX]], 1
; CHECK-NEXT: [[IDX_FOR_ABC:%.*]] = add i32 [[IDX]], 4
; CHECK-NEXT: [[ABC_ACTUAL:%.*]] = icmp slt i32 [[IDX_FOR_ABC]], [[LEN]]
-; CHECK-NEXT: [[COND:%.*]] = load volatile i1, i1* [[COND_BUF:%.*]], align 1
+; CHECK-NEXT: [[COND:%.*]] = load volatile i1, ptr [[COND_BUF:%.*]], align 1
; CHECK-NEXT: [[ABC:%.*]] = and i1 [[COND]], true
; CHECK-NEXT: br i1 [[ABC]], label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS_LOOPEXIT2:%.*]], !prof [[PROF1:![0-9]+]]
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, i32* [[ARR:%.*]], i32 [[IDX_FOR_ABC]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR:%.*]], i32 [[IDX_FOR_ABC]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp slt i32 [[IDX_NEXT]], [[N]]
; CHECK-NEXT: [[TMP2:%.*]] = icmp slt i32 [[IDX_NEXT]], [[EXIT_MAINLOOP_AT]]
; CHECK-NEXT: br i1 [[TMP2]], label [[LOOP]], label [[MAIN_EXIT_SELECTOR:%.*]]
; CHECK-NEXT: [[IDX_NEXT_POSTLOOP]] = add i32 [[IDX_POSTLOOP]], 1
; CHECK-NEXT: [[IDX_FOR_ABC_POSTLOOP:%.*]] = add i32 [[IDX_POSTLOOP]], 4
; CHECK-NEXT: [[ABC_ACTUAL_POSTLOOP:%.*]] = icmp slt i32 [[IDX_FOR_ABC_POSTLOOP]], [[LEN]]
-; CHECK-NEXT: [[COND_POSTLOOP:%.*]] = load volatile i1, i1* [[COND_BUF]], align 1
+; CHECK-NEXT: [[COND_POSTLOOP:%.*]] = load volatile i1, ptr [[COND_BUF]], align 1
; CHECK-NEXT: [[ABC_POSTLOOP:%.*]] = and i1 [[COND_POSTLOOP]], [[ABC_ACTUAL_POSTLOOP]]
; CHECK-NEXT: br i1 [[ABC_POSTLOOP]], label [[IN_BOUNDS_POSTLOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT:%.*]], !prof [[PROF1]]
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, i32* [[ARR]], i32 [[IDX_FOR_ABC_POSTLOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX_FOR_ABC_POSTLOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_POSTLOOP]], align 4
; CHECK-NEXT: [[NEXT_POSTLOOP:%.*]] = icmp slt i32 [[IDX_NEXT_POSTLOOP]], [[N]]
; CHECK-NEXT: br i1 [[NEXT_POSTLOOP]], label [[LOOP_POSTLOOP]], label [[EXIT_LOOPEXIT_LOOPEXIT:%.*]], !llvm.loop [[LOOP2:![0-9]+]], !irce.loop.clone !7
;
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
%idx.next = add i32 %idx, 1
%idx.for.abc = add i32 %idx, 4
%abc.actual = icmp slt i32 %idx.for.abc, %len
- %cond = load volatile i1, i1* %cond_buf
+ %cond = load volatile i1, ptr %cond_buf
%abc = and i1 %cond, %abc.actual
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx.for.abc
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx.for.abc
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
define void @f_1(
; CHECK-LABEL: @f_1(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[LEN_A:%.*]] = load i32, i32* [[A_LEN_PTR:%.*]], align 4, !range [[RNG0]]
-; CHECK-NEXT: [[LEN_B:%.*]] = load i32, i32* [[B_LEN_PTR:%.*]], align 4, !range [[RNG0]]
+; CHECK-NEXT: [[LEN_A:%.*]] = load i32, ptr [[A_LEN_PTR:%.*]], align 4, !range [[RNG0]]
+; CHECK-NEXT: [[LEN_B:%.*]] = load i32, ptr [[B_LEN_PTR:%.*]], align 4, !range [[RNG0]]
; CHECK-NEXT: [[FIRST_ITR_CHECK:%.*]] = icmp sgt i32 [[N:%.*]], 0
; CHECK-NEXT: br i1 [[FIRST_ITR_CHECK]], label [[LOOP_PREHEADER:%.*]], label [[EXIT:%.*]]
; CHECK: loop.preheader:
; CHECK-NEXT: [[ABC:%.*]] = and i1 true, true
; CHECK-NEXT: br i1 [[ABC]], label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS_LOOPEXIT3:%.*]], !prof [[PROF1]]
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR_A:%.*]] = getelementptr i32, i32* [[ARR_A:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_A]], align 4
-; CHECK-NEXT: [[ADDR_B:%.*]] = getelementptr i32, i32* [[ARR_B:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 -1, i32* [[ADDR_B]], align 4
+; CHECK-NEXT: [[ADDR_A:%.*]] = getelementptr i32, ptr [[ARR_A:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_A]], align 4
+; CHECK-NEXT: [[ADDR_B:%.*]] = getelementptr i32, ptr [[ARR_B:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 -1, ptr [[ADDR_B]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp slt i32 [[IDX_NEXT]], [[N]]
; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i32 [[IDX_NEXT]], [[EXIT_MAINLOOP_AT]]
; CHECK-NEXT: br i1 [[TMP1]], label [[LOOP]], label [[MAIN_EXIT_SELECTOR:%.*]]
; CHECK-NEXT: [[ABC_POSTLOOP:%.*]] = and i1 [[ABC_A_POSTLOOP]], [[ABC_B_POSTLOOP]]
; CHECK-NEXT: br i1 [[ABC_POSTLOOP]], label [[IN_BOUNDS_POSTLOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT:%.*]], !prof [[PROF1]]
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: [[ADDR_A_POSTLOOP:%.*]] = getelementptr i32, i32* [[ARR_A]], i32 [[IDX_POSTLOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_A_POSTLOOP]], align 4
-; CHECK-NEXT: [[ADDR_B_POSTLOOP:%.*]] = getelementptr i32, i32* [[ARR_B]], i32 [[IDX_POSTLOOP]]
-; CHECK-NEXT: store i32 -1, i32* [[ADDR_B_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_A_POSTLOOP:%.*]] = getelementptr i32, ptr [[ARR_A]], i32 [[IDX_POSTLOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_A_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_B_POSTLOOP:%.*]] = getelementptr i32, ptr [[ARR_B]], i32 [[IDX_POSTLOOP]]
+; CHECK-NEXT: store i32 -1, ptr [[ADDR_B_POSTLOOP]], align 4
; CHECK-NEXT: [[NEXT_POSTLOOP:%.*]] = icmp slt i32 [[IDX_NEXT_POSTLOOP]], [[N]]
; CHECK-NEXT: br i1 [[NEXT_POSTLOOP]], label [[LOOP_POSTLOOP]], label [[EXIT_LOOPEXIT_LOOPEXIT:%.*]], !llvm.loop [[LOOP8:![0-9]+]], !irce.loop.clone !7
;
- i32* %arr_a, i32* %a_len_ptr, i32* %arr_b, i32* %b_len_ptr, i32 %n) {
+ ptr %arr_a, ptr %a_len_ptr, ptr %arr_b, ptr %b_len_ptr, i32 %n) {
entry:
- %len.a = load i32, i32* %a_len_ptr, !range !0
- %len.b = load i32, i32* %b_len_ptr, !range !0
+ %len.a = load i32, ptr %a_len_ptr, !range !0
+ %len.b = load i32, ptr %b_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %addr.a = getelementptr i32, i32* %arr_a, i32 %idx
- store i32 0, i32* %addr.a
- %addr.b = getelementptr i32, i32* %arr_b, i32 %idx
- store i32 -1, i32* %addr.b
+ %addr.a = getelementptr i32, ptr %arr_a, i32 %idx
+ store i32 0, ptr %addr.a
+ %addr.b = getelementptr i32, ptr %arr_b, i32 %idx
+ store i32 -1, ptr %addr.b
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; were incorrectly updating LI when the split loop is a subloop as in the case below.
source_filename = "correct-loop-info.ll"
-define void @baz() personality i32* ()* @ham {
+define void @baz() personality ptr @ham {
; CHECK-LABEL: @baz(
; CHECK-NEXT: bb:
; CHECK-NEXT: [[EXIT_PRELOOP_AT:%.*]] = call i32 @llvm.smax.i32(i32 undef, i32 -1)
; CHECK-NEXT: [[INDVAR_END1:%.*]] = phi i32 [ [[INDVAR_END]], [[MAINLOOP]] ], [ [[TMP6_LCSSA]], [[MAIN_EXIT_SELECTOR]] ]
; CHECK-NEXT: br label [[POSTLOOP:%.*]]
; CHECK: outer_exiting.loopexit:
-; CHECK-NEXT: [[LPAD_LOOPEXIT:%.*]] = landingpad { i8*, i32 }
+; CHECK-NEXT: [[LPAD_LOOPEXIT:%.*]] = landingpad { ptr, i32 }
; CHECK-NEXT: cleanup
; CHECK-NEXT: br label [[OUTER_EXITING:%.*]]
; CHECK: outer_exiting.loopexit.split-lp.loopexit:
-; CHECK-NEXT: [[LPAD_LOOPEXIT2:%.*]] = landingpad { i8*, i32 }
+; CHECK-NEXT: [[LPAD_LOOPEXIT2:%.*]] = landingpad { ptr, i32 }
; CHECK-NEXT: cleanup
; CHECK-NEXT: br label [[OUTER_EXITING_LOOPEXIT_SPLIT_LP:%.*]]
; CHECK: outer_exiting.loopexit.split-lp.loopexit.split-lp:
-; CHECK-NEXT: [[LPAD_LOOPEXIT_SPLIT_LP3:%.*]] = landingpad { i8*, i32 }
+; CHECK-NEXT: [[LPAD_LOOPEXIT_SPLIT_LP3:%.*]] = landingpad { ptr, i32 }
; CHECK-NEXT: cleanup
; CHECK-NEXT: br label [[OUTER_EXITING_LOOPEXIT_SPLIT_LP]]
; CHECK: outer_exiting.loopexit.split-lp:
br i1 %tmp9, label %innerheader, label %bb13
outer_exiting: ; preds = %innerheader
- %tmp11 = landingpad { i8*, i32 }
+ %tmp11 = landingpad { ptr, i32 }
cleanup
switch i32 undef, label %exit2 [
i32 142, label %bb14
ret void
}
-declare i32* @ham()
+declare ptr @ham()
declare void @pluto()
; RUN: opt -verify-loop-info -irce -S < %s | FileCheck %s
; RUN: opt -verify-loop-info -passes='require<branch-prob>,irce' -S < %s | FileCheck %s
-define void @decrementing_loop(i32 *%arr, i32 *%a_len_ptr, i32 %n) {
+define void @decrementing_loop(ptr %arr, ptr %a_len_ptr, i32 %n) {
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
%start = sub i32 %n, 1
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp sgt i32 %idx.dec, -1
br i1 %next, label %loop, label %exit
; Make sure that we can eliminate the range check when the loop looks like:
; for (i = len.a - 1; i >= 0; --i)
; b[i] = a[i];
-define void @test_01(i32* %a, i32* %b, i32* %a_len_ptr, i32* %b_len_ptr) {
+define void @test_01(ptr %a, ptr %b, ptr %a_len_ptr, ptr %b_len_ptr) {
; CHECK-LABEL: test_01
; CHECK: mainloop:
; CHECK: loop.preloop:
entry:
- %len.a = load i32, i32* %a_len_ptr, !range !0
- %len.b = load i32, i32* %b_len_ptr, !range !0
+ %len.a = load i32, ptr %a_len_ptr, !range !0
+ %len.b = load i32, ptr %b_len_ptr, !range !0
%first.itr.check = icmp ne i32 %len.a, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %rc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %el.a = getelementptr i32, i32* %a, i32 %idx.next
- %el.b = getelementptr i32, i32* %b, i32 %idx.next
- %v = load i32, i32* %el.a
- store i32 %v, i32* %el.b
+ %el.a = getelementptr i32, ptr %a, i32 %idx.next
+ %el.b = getelementptr i32, ptr %b, i32 %idx.next
+ %v = load i32, ptr %el.a
+ store i32 %v, ptr %el.b
%loop.cond = icmp slt i32 %idx, 2
br i1 %loop.cond, label %exit, label %loop
}
; Same as test_01, but the latch condition is unsigned
-define void @test_02(i32* %a, i32* %b, i32* %a_len_ptr, i32* %b_len_ptr) {
+define void @test_02(ptr %a, ptr %b, ptr %a_len_ptr, ptr %b_len_ptr) {
; CHECK-LABEL: test_02
; CHECK: mainloop:
; CHECK: loop.preloop:
entry:
- %len.a = load i32, i32* %a_len_ptr, !range !0
- %len.b = load i32, i32* %b_len_ptr, !range !0
+ %len.a = load i32, ptr %a_len_ptr, !range !0
+ %len.b = load i32, ptr %b_len_ptr, !range !0
%first.itr.check = icmp ne i32 %len.a, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %rc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %el.a = getelementptr i32, i32* %a, i32 %idx.next
- %el.b = getelementptr i32, i32* %b, i32 %idx.next
- %v = load i32, i32* %el.a
- store i32 %v, i32* %el.b
+ %el.a = getelementptr i32, ptr %a, i32 %idx.next
+ %el.b = getelementptr i32, ptr %b, i32 %idx.next
+ %v = load i32, ptr %el.a
+ store i32 %v, ptr %el.b
%loop.cond = icmp ult i32 %idx, 2
br i1 %loop.cond, label %exit, label %loop
; Check that we can figure out that IV is non-negative via implication through
; Phi node.
-define void @test_03(i32* %a, i32* %a_len_ptr, i1 %cond) {
+define void @test_03(ptr %a, ptr %a_len_ptr, i1 %cond) {
; CHECK-LABEL: test_03
; CHECK: mainloop:
; CHECK: loop.preloop:
entry:
- %len.a = load i32, i32* %a_len_ptr, !range !0
+ %len.a = load i32, ptr %a_len_ptr, !range !0
%len.minus.one = sub nsw i32 %len.a, 1
%len.minus.two = sub nsw i32 %len.a, 2
br i1 %cond, label %if.true, label %if.false
br i1 %rc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %el.a = getelementptr i32, i32* %a, i32 %idx.next
- %v = load i32, i32* %el.a
+ %el.a = getelementptr i32, ptr %a, i32 %idx.next
+ %v = load i32, ptr %el.a
%loop.cond = icmp slt i32 %idx, 2
br i1 %loop.cond, label %exit, label %loop
; Check that we can figure out that IV is non-negative via implication through
; two Phi nodes.
-define void @test_04(i32* %a, i32* %a_len_ptr, i1 %cond) {
+define void @test_04(ptr %a, ptr %a_len_ptr, i1 %cond) {
; CHECK-LABEL: test_04
; CHECK: mainloop:
; CHECK: loop.preloop:
entry:
- %len.a = load i32, i32* %a_len_ptr, !range !0
+ %len.a = load i32, ptr %a_len_ptr, !range !0
%len.minus.one = sub nsw i32 %len.a, 1
%len.plus.one = add nsw i32 %len.a, 1
%len.minus.two = sub nsw i32 %len.a, 2
br i1 %rc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %el.a = getelementptr i32, i32* %a, i32 %idx.next
- %v = load i32, i32* %el.a
+ %el.a = getelementptr i32, ptr %a, i32 %idx.next
+ %v = load i32, ptr %el.a
%loop.cond = icmp slt i32 %idx, 2
br i1 %loop.cond, label %exit, label %loop
; Check that we can figure out that IV is non-negative via implication through
; two Phi nodes, one being AddRec.
-define void @test_05(i32* %a, i32* %a_len_ptr, i1 %cond) {
+define void @test_05(ptr %a, ptr %a_len_ptr, i1 %cond) {
; CHECK-LABEL: test_05
; CHECK: mainloop:
; CHECK: loop.preloop:
entry:
- %len.a = load i32, i32* %a_len_ptr, !range !0
+ %len.a = load i32, ptr %a_len_ptr, !range !0
%len.minus.one = sub nsw i32 %len.a, 1
%len.plus.one = add nsw i32 %len.a, 1
%len.minus.two = sub nsw i32 %len.a, 2
br i1 %rc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %el.a = getelementptr i32, i32* %a, i32 %idx.next
- %v = load i32, i32* %el.a
+ %el.a = getelementptr i32, ptr %a, i32 %idx.next
+ %v = load i32, ptr %el.a
%loop.cond = icmp slt i32 %idx, 2
br i1 %loop.cond, label %exit, label %loop
; that we will never go to the main loop in the latter case and basically
; only duplicate code with no benefits.
-define void @test_01(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_01(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK-LABEL: test_01(
; CHECK-NOT: preloop
; CHECK: entry:
; CHECK-NEXT: br i1 true, label %loop.preheader, label %main.pseudo.exit
; CHECK: in.bounds.1:
-; CHECK-NEXT: %addr = getelementptr i32, i32* %arr, i32 %idx
-; CHECK-NEXT: store i32 0, i32* %addr
+; CHECK-NEXT: %addr = getelementptr i32, ptr %arr, i32 %idx
+; CHECK-NEXT: store i32 0, ptr %addr
; CHECK-NEXT: %off1 = add i32 %idx, 30
; CHECK-NEXT: %c2 = icmp slt i32 %off1, 40
; CHECK-NEXT: br i1 true, label %in.bounds.2, label %exit.loopexit2
br i1 %c1, label %in.bounds.1, label %out.of.bounds
in.bounds.1:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%off1 = add i32 %idx, 30
%c2 = icmp slt i32 %off1, 40
br i1 %c2, label %in.bounds.2, label %exit
; Show that IRCE can turn 'ne' condition to 'slt' in increasing IV when the IV
; can be negative at some point.
-define void @test_01(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_01(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_01
; CHECK: main.exit.selector:
; CHECK-NEXT: br i1 [[COND]]
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ne i32 %idx.next, 100
br i1 %next, label %loop, label %exit
; Show that IRCE can turn 'ne' condition to 'ult' in increasing IV when IV is
; non-negative.
-define void @test_01u(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_01u(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_01u
; CHECK: main.exit.selector:
; CHECK-NEXT: br i1 [[COND]]
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ne i32 %idx.next, 100
br i1 %next, label %loop, label %exit
; Show that if n is not known to be greater than the starting value, IRCE
; doesn't apply.
-define void @test_02(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_02(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_02(
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ne i32 %idx.next, -100
br i1 %next, label %loop, label %exit
}
; Show that IRCE can turn 'eq' condition to 'sge' in increasing IV.
-define void @test_03(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_03(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_03(
; CHECK: main.exit.selector:
; CHECK-NEXT: br i1 [[COND]]
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp eq i32 %idx.next, 100
br i1 %next, label %exit, label %loop
ret void
}
-define void @test_04(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_04(ptr %arr, ptr %a_len_ptr) #0 {
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp eq i32 %idx.next, -100
br i1 %next, label %exit, label %loop
}
; Show that IRCE can turn 'ne' condition to 'sgt' in decreasing IV.
-define void @test_05(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_05(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_05(
; CHECK: preloop.exit.selector:
; CHECK-NEXT: br i1 [[COND]]
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ne i32 %idx.next, 0
br i1 %next, label %loop, label %exit
; Show that IRCE cannot turn 'ne' condition to 'sgt' in decreasing IV if the end
; value is not proved to be less than the start value.
-define void @test_06(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_06(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_06(
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ne i32 %idx.next, 120
br i1 %next, label %loop, label %exit
}
; Show that IRCE can turn 'eq' condition to 'slt' in decreasing IV.
-define void @test_07(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_07(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_07(
; CHECK: preloop.exit.selector:
; CHECK-NEXT: br i1 [[COND]]
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp eq i32 %idx.next, 0
br i1 %next, label %exit, label %loop
; Show that IRCE cannot turn 'eq' condition to 'slt' in decreasing IV if the end
; value is not proved to be less than the start value.
-define void @test_08(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_08(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_08(
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp eq i32 %idx.next, 120
br i1 %next, label %exit, label %loop
; CHECK-NOT: constrained Loop
-define void @low_profiled_be_count(i32 *%arr, i32 *%a_len_ptr, i32 %n) {
+define void @low_profiled_be_count(ptr %arr, ptr %a_len_ptr, i32 %n) {
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit, !prof !2
; CHECK-NO-NOT: constrained Loop
define i32 @multiple_access_no_preloop(
- i32* %arr_a, i32* %a_len_ptr, i32* %arr_b, i32* %b_len_ptr, i32 %n) {
+ ptr %arr_a, ptr %a_len_ptr, ptr %arr_b, ptr %b_len_ptr, i32 %n) {
entry:
- %len.a = load i32, i32* %a_len_ptr, !range !0
+ %len.a = load i32, ptr %a_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit, !prof !1
br i1 %abc.a, label %in.bounds.a, label %exit, !prof !2
in.bounds.a:
- %addr.a = getelementptr i32, i32* %arr_a, i32 %idx
- %val = load i32, i32* %addr.a
+ %addr.a = getelementptr i32, ptr %arr_a, i32 %idx
+ %val = load i32, ptr %addr.a
%cond = icmp ne i32 %val, 0
; Most probable exit from a loop.
br i1 %cond, label %found, label %backedge, !prof !3
define void @multiple_access_no_preloop(
; CHECK-LABEL: @multiple_access_no_preloop(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[LEN_A:%.*]] = load i32, i32* [[A_LEN_PTR:%.*]], align 4, !range [[RNG0:![0-9]+]]
-; CHECK-NEXT: [[LEN_B:%.*]] = load i32, i32* [[B_LEN_PTR:%.*]], align 4, !range [[RNG0]]
+; CHECK-NEXT: [[LEN_A:%.*]] = load i32, ptr [[A_LEN_PTR:%.*]], align 4, !range [[RNG0:![0-9]+]]
+; CHECK-NEXT: [[LEN_B:%.*]] = load i32, ptr [[B_LEN_PTR:%.*]], align 4, !range [[RNG0]]
; CHECK-NEXT: [[FIRST_ITR_CHECK:%.*]] = icmp sgt i32 [[N:%.*]], 0
; CHECK-NEXT: br i1 [[FIRST_ITR_CHECK]], label [[LOOP_PREHEADER:%.*]], label [[EXIT:%.*]]
; CHECK: loop.preheader:
; CHECK-NEXT: [[ABC_A:%.*]] = icmp slt i32 [[IDX]], [[LEN_A]]
; CHECK-NEXT: br i1 true, label [[IN_BOUNDS_A:%.*]], label [[OUT_OF_BOUNDS_LOOPEXIT3:%.*]], !prof [[PROF1:![0-9]+]]
; CHECK: in.bounds.a:
-; CHECK-NEXT: [[ADDR_A:%.*]] = getelementptr i32, i32* [[ARR_A:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_A]], align 4
+; CHECK-NEXT: [[ADDR_A:%.*]] = getelementptr i32, ptr [[ARR_A:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_A]], align 4
; CHECK-NEXT: [[ABC_B:%.*]] = icmp slt i32 [[IDX]], [[LEN_B]]
; CHECK-NEXT: br i1 true, label [[IN_BOUNDS_B]], label [[OUT_OF_BOUNDS_LOOPEXIT3]], !prof [[PROF1]]
; CHECK: in.bounds.b:
-; CHECK-NEXT: [[ADDR_B:%.*]] = getelementptr i32, i32* [[ARR_B:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 -1, i32* [[ADDR_B]], align 4
+; CHECK-NEXT: [[ADDR_B:%.*]] = getelementptr i32, ptr [[ARR_B:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 -1, ptr [[ADDR_B]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp slt i32 [[IDX_NEXT]], [[N]]
; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i32 [[IDX_NEXT]], [[EXIT_MAINLOOP_AT]]
; CHECK-NEXT: br i1 [[TMP1]], label [[LOOP]], label [[MAIN_EXIT_SELECTOR:%.*]]
; CHECK-NEXT: [[ABC_A_POSTLOOP:%.*]] = icmp slt i32 [[IDX_POSTLOOP]], [[LEN_A]]
; CHECK-NEXT: br i1 [[ABC_A_POSTLOOP]], label [[IN_BOUNDS_A_POSTLOOP:%.*]], label [[OUT_OF_BOUNDS_LOOPEXIT:%.*]], !prof [[PROF1]]
; CHECK: in.bounds.a.postloop:
-; CHECK-NEXT: [[ADDR_A_POSTLOOP:%.*]] = getelementptr i32, i32* [[ARR_A]], i32 [[IDX_POSTLOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_A_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_A_POSTLOOP:%.*]] = getelementptr i32, ptr [[ARR_A]], i32 [[IDX_POSTLOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_A_POSTLOOP]], align 4
; CHECK-NEXT: [[ABC_B_POSTLOOP:%.*]] = icmp slt i32 [[IDX_POSTLOOP]], [[LEN_B]]
; CHECK-NEXT: br i1 [[ABC_B_POSTLOOP]], label [[IN_BOUNDS_B_POSTLOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT]], !prof [[PROF1]]
; CHECK: in.bounds.b.postloop:
-; CHECK-NEXT: [[ADDR_B_POSTLOOP:%.*]] = getelementptr i32, i32* [[ARR_B]], i32 [[IDX_POSTLOOP]]
-; CHECK-NEXT: store i32 -1, i32* [[ADDR_B_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_B_POSTLOOP:%.*]] = getelementptr i32, ptr [[ARR_B]], i32 [[IDX_POSTLOOP]]
+; CHECK-NEXT: store i32 -1, ptr [[ADDR_B_POSTLOOP]], align 4
; CHECK-NEXT: [[NEXT_POSTLOOP:%.*]] = icmp slt i32 [[IDX_NEXT_POSTLOOP]], [[N]]
; CHECK-NEXT: br i1 [[NEXT_POSTLOOP]], label [[LOOP_POSTLOOP]], label [[EXIT_LOOPEXIT_LOOPEXIT:%.*]], !llvm.loop [[LOOP2:![0-9]+]], !irce.loop.clone !7
;
- i32* %arr_a, i32* %a_len_ptr, i32* %arr_b, i32* %b_len_ptr, i32 %n) {
+ ptr %arr_a, ptr %a_len_ptr, ptr %arr_b, ptr %b_len_ptr, i32 %n) {
entry:
- %len.a = load i32, i32* %a_len_ptr, !range !0
- %len.b = load i32, i32* %b_len_ptr, !range !0
+ %len.a = load i32, ptr %a_len_ptr, !range !0
+ %len.b = load i32, ptr %b_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc.a, label %in.bounds.a, label %out.of.bounds, !prof !1
in.bounds.a:
- %addr.a = getelementptr i32, i32* %arr_a, i32 %idx
- store i32 0, i32* %addr.a
+ %addr.a = getelementptr i32, ptr %arr_a, i32 %idx
+ store i32 0, ptr %addr.a
%abc.b = icmp slt i32 %idx, %len.b
br i1 %abc.b, label %in.bounds.b, label %out.of.bounds, !prof !1
in.bounds.b:
- %addr.b = getelementptr i32, i32* %arr_b, i32 %idx
- store i32 -1, i32* %addr.b
+ %addr.b = getelementptr i32, ptr %arr_b, i32 %idx
+ store i32 -1, ptr %addr.b
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; RUN: opt -S -irce -verify-loop-info -verify < %s 2>&1 | FileCheck %s
; RUN: opt -S -verify-loop-info -passes=irce,verify < %s 2>&1 | FileCheck %s
-define i32 @test_01(i32 %A, i64 %Len, i32 *%array) {
+define i32 @test_01(i32 %A, i64 %Len, ptr %array) {
; CHECK-LABEL: @test_01(
; CHECK-NEXT: preheader:
; CHECK-NEXT: [[TRIPCHECK:%.*]] = icmp sgt i64 [[LEN:%.*]], 2
; CHECK-NEXT: [[TMP4:%.*]] = icmp ult i64 [[INDVAR]], [[LEN]]
; CHECK-NEXT: br i1 true, label [[GUARDED:%.*]], label [[DEOPT_LOOPEXIT3:%.*]]
; CHECK: guarded:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr inbounds i32, i32* [[ARRAY:%.*]], i64 [[INDVAR]]
-; CHECK-NEXT: [[RES:%.*]] = load i32, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr inbounds i32, ptr [[ARRAY:%.*]], i64 [[INDVAR]]
+; CHECK-NEXT: [[RES:%.*]] = load i32, ptr [[ADDR]], align 4
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[RES]], 0
; CHECK-NEXT: br i1 [[CMP]], label [[ZERO_LOOPEXIT_LOOPEXIT4:%.*]], label [[LATCH]]
; CHECK: latch:
; CHECK-NEXT: [[TMP9:%.*]] = icmp ult i64 [[INDVAR_POSTLOOP]], [[LEN]]
; CHECK-NEXT: br i1 [[TMP9]], label [[GUARDED_POSTLOOP:%.*]], label [[DEOPT_LOOPEXIT:%.*]]
; CHECK: guarded.postloop:
-; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr inbounds i32, i32* [[ARRAY]], i64 [[INDVAR_POSTLOOP]]
-; CHECK-NEXT: [[RES_POSTLOOP:%.*]] = load i32, i32* [[ADDR_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr inbounds i32, ptr [[ARRAY]], i64 [[INDVAR_POSTLOOP]]
+; CHECK-NEXT: [[RES_POSTLOOP:%.*]] = load i32, ptr [[ADDR_POSTLOOP]], align 4
; CHECK-NEXT: [[CMP_POSTLOOP:%.*]] = icmp eq i32 [[RES_POSTLOOP]], 0
; CHECK-NEXT: br i1 [[CMP_POSTLOOP]], label [[ZERO_LOOPEXIT_LOOPEXIT:%.*]], label [[LATCH_POSTLOOP]]
; CHECK: latch.postloop:
br i1 %0, label %guarded, label %deopt
guarded:
- %addr = getelementptr inbounds i32, i32* %array, i64 %indvar
- %res = load i32, i32* %addr
+ %addr = getelementptr inbounds i32, ptr %array, i64 %indvar
+ %res = load i32, ptr %addr
%cmp = icmp eq i32 %res, 0
br i1 %cmp, label %zero, label %latch
; RUN: opt -verify-loop-info -passes='require<branch-prob>,irce' -irce-print-range-checks -irce-print-changed-loops %s -S 2>&1 | FileCheck %s
; Make sure that we can pick up both range checks.
-define void @test_01(i32 *%arr, i32* %a_len_ptr, i32* %size_ptr) {
+define void @test_01(ptr %arr, ptr %a_len_ptr, ptr %size_ptr) {
; CHECK-LABEL: @test_01(
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
- %size = load i32, i32* %size_ptr
+ %len = load i32, ptr %a_len_ptr, !range !0
+ %size = load i32, ptr %size_ptr
%first_iter_check = icmp sle i32 %size, 0
br i1 %first_iter_check, label %exit, label %loop
backedge:
%iv.next = add i32 %iv, 1
- %arr_el_ptr = getelementptr i32, i32* %arr, i32 %iv
- %el = load i32, i32* %arr_el_ptr
+ %arr_el_ptr = getelementptr i32, ptr %arr, i32 %iv
+ %el = load i32, ptr %arr_el_ptr
%loopcond = icmp ne i32 %iv, %size
br i1 %loopcond, label %loop, label %exit
}
; Same as test_01, unsigned predicates.
-define void @test_02(i32 *%arr, i32* %a_len_ptr, i32* %size_ptr) {
+define void @test_02(ptr %arr, ptr %a_len_ptr, ptr %size_ptr) {
; CHECK-LABEL: @test_02(
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
- %size = load i32, i32* %size_ptr
+ %len = load i32, ptr %a_len_ptr, !range !0
+ %size = load i32, ptr %size_ptr
%first_iter_check = icmp sle i32 %size, 0
br i1 %first_iter_check, label %exit, label %loop
backedge:
%iv.next = add i32 %iv, 1
- %arr_el_ptr = getelementptr i32, i32* %arr, i32 %iv
- %el = load i32, i32* %arr_el_ptr
+ %arr_el_ptr = getelementptr i32, ptr %arr, i32 %iv
+ %el = load i32, ptr %arr_el_ptr
%loopcond = icmp ne i32 %iv, %size
br i1 %loopcond, label %loop, label %exit
ret void
}
-define void @test_03(i32 *%arr, i32* %a_len_ptr, i32* %size_ptr) {
+define void @test_03(ptr %arr, ptr %a_len_ptr, ptr %size_ptr) {
; CHECK-LABEL: @test_03(
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
- %size = load i32, i32* %size_ptr
+ %len = load i32, ptr %a_len_ptr, !range !0
+ %size = load i32, ptr %size_ptr
%first_iter_check = icmp eq i32 %size, 0
br i1 %first_iter_check, label %exit, label %loop
backedge:
%iv.next = add i32 %iv, 1
- %arr_el_ptr = getelementptr i32, i32* %arr, i32 %iv
- %el = load i32, i32* %arr_el_ptr
+ %arr_el_ptr = getelementptr i32, ptr %arr, i32 %iv
+ %el = load i32, ptr %arr_el_ptr
%loopcond = icmp ne i32 %iv, %len
br i1 %loopcond, label %loop, label %exit
ret void
}
-define void @test_04(i32 *%arr, i32* %a_len_ptr, i32* %size_ptr) {
+define void @test_04(ptr %arr, ptr %a_len_ptr, ptr %size_ptr) {
; CHECK-LABEL: @test_04(
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
- %size = load i32, i32* %size_ptr
+ %len = load i32, ptr %a_len_ptr, !range !0
+ %size = load i32, ptr %size_ptr
%first_iter_check = icmp eq i32 %size, 0
br i1 %first_iter_check, label %exit, label %loop
backedge:
%iv.next = add i32 %iv, 1
- %arr_el_ptr = getelementptr i32, i32* %arr, i32 %iv
- %el = load i32, i32* %arr_el_ptr
+ %arr_el_ptr = getelementptr i32, ptr %arr, i32 %iv
+ %el = load i32, ptr %arr_el_ptr
%loopcond = icmp ne i32 %iv, %len
br i1 %loopcond, label %loop, label %exit
; CHECK-NOT: constrained Loop
define void @multiple_access_no_preloop(
- i32* %arr_a, i32* %a_len_ptr, i32* %arr_b, i32* %b_len_ptr, i32 %n) {
+ ptr %arr_a, ptr %a_len_ptr, ptr %arr_b, ptr %b_len_ptr, i32 %n) {
entry:
- %len.a = load i32, i32* %a_len_ptr, !range !0
- %len.b = load i32, i32* %b_len_ptr, !range !0
+ %len.a = load i32, ptr %a_len_ptr, !range !0
+ %len.b = load i32, ptr %b_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc.a, label %in.bounds.a, label %out.of.bounds, !prof !1
in.bounds.a:
- %addr.a = getelementptr i32, i32* %arr_a, i32 %idx
- store i32 0, i32* %addr.a
+ %addr.a = getelementptr i32, ptr %arr_a, i32 %idx
+ store i32 0, ptr %addr.a
%abc.b = icmp slt i32 %idx, %len.b
br i1 %abc.b, label %in.bounds.b, label %out.of.bounds, !prof !1
in.bounds.b:
- %addr.b = getelementptr i32, i32* %arr_b, i32 %idx
- store i32 -1, i32* %addr.b
+ %addr.b = getelementptr i32, ptr %arr_b, i32 %idx
+ store i32 -1, ptr %addr.b
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; CHECK-NEXT: CheckUse: br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1 Operand: 0
; CHECK-NEXT: irce: in function only_lower_check: constrained Loop at depth 1 containing: %loop<header><exiting>,%in.bounds<latch><exiting>
-define void @only_lower_check(i32 *%arr, i32 *%a_len_ptr, i32 %n) {
+define void @only_lower_check(ptr %arr, ptr %a_len_ptr, i32 %n) {
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
%start = sub i32 %n, 1
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp sgt i32 %idx.dec, -1
br i1 %next, label %loop, label %exit
; CHECK-NEXT: CheckUse: br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1 Operand: 0
; CHECK-NEXT: irce: in function incrementing: constrained Loop at depth 1 containing: %loop<header><exiting>,%in.bounds<latch><exiting>
-define void @incrementing(i32 *%arr, i32 *%a_len_ptr, i32 %n, i32 %offset) {
+define void @incrementing(ptr %arr, ptr %a_len_ptr, i32 %n, i32 %offset) {
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %array.idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %array.idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[CONT48:%.*]]
; CHECK: cont48:
-; CHECK-NEXT: [[A2_0121:%.*]] = phi i16* [ [[ADD_PTR74:%.*]], [[CONT76:%.*]] ], [ getelementptr inbounds ([1528 x i16], [1528 x i16]* @array, i16 0, i16 0), [[ENTRY:%.*]] ]
+; CHECK-NEXT: [[A2_0121:%.*]] = phi ptr [ [[ADD_PTR74:%.*]], [[CONT76:%.*]] ], [ @array, [[ENTRY:%.*]] ]
; CHECK-NEXT: [[I41_0119:%.*]] = phi i16 [ [[ADD73:%.*]], [[CONT76]] ], [ 0, [[ENTRY]] ]
; CHECK-NEXT: [[ADD73]] = add nuw nsw i16 [[I41_0119]], 2
-; CHECK-NEXT: [[ADD_PTR74]] = getelementptr inbounds i16, i16* [[A2_0121]], i16 2
-; CHECK-NEXT: [[TMP0:%.*]] = icmp ult i16* [[A2_0121]], inttoptr (i16 -2 to i16*)
+; CHECK-NEXT: [[ADD_PTR74]] = getelementptr inbounds i16, ptr [[A2_0121]], i16 2
+; CHECK-NEXT: [[TMP0:%.*]] = icmp ult ptr [[A2_0121]], inttoptr (i16 -2 to ptr)
; CHECK-NEXT: br i1 [[TMP0]], label [[CONT76]], label [[HANDLER_POINTER_OVERFLOW75:%.*]]
; CHECK: handler.pointer_overflow75:
; CHECK-NEXT: unreachable
br label %cont48
cont48: ; preds = %cont76, %entry
- %a2.0121 = phi i16* [ %add.ptr74, %cont76 ], [ getelementptr inbounds ([1528 x i16], [1528 x i16]* @array, i16 0, i16 0), %entry ]
+ %a2.0121 = phi ptr [ %add.ptr74, %cont76 ], [ @array, %entry ]
%i41.0119 = phi i16 [ %add73, %cont76 ], [ 0, %entry ]
%add73 = add nuw nsw i16 %i41.0119, 2
- %add.ptr74 = getelementptr inbounds i16, i16* %a2.0121, i16 2
- %0 = icmp ult i16* %a2.0121, inttoptr (i16 -2 to i16*)
+ %add.ptr74 = getelementptr inbounds i16, ptr %a2.0121, i16 2
+ %0 = icmp ult ptr %a2.0121, inttoptr (i16 -2 to ptr)
br i1 %0, label %cont76, label %handler.pointer_overflow75
handler.pointer_overflow75: ; preds = %cont48
bb12: ; preds = %bb8, %bb5
%tmp13 = phi i32 [ 1, %bb5 ], [ %tmp9, %bb8 ]
%tmp14 = add nuw nsw i32 %tmp13, 1
- %tmp15 = load atomic i32, i32 addrspace(1)* undef unordered, align 8
+ %tmp15 = load atomic i32, ptr addrspace(1) undef unordered, align 8
%tmp16 = icmp ult i32 %tmp14, %tmp6
br i1 %tmp16, label %bb8, label %bb17
; CHECK: irce: in function test_02: constrained Loop at depth 1 containing: %loop<header><exiting>,%in.bounds<latch><exiting>
; Iterate from 0 to SINT_MAX, check that the post-loop is generated.
-define void @test_01(i32* %arr, i32* %a_len_ptr) {
+define void @test_01(ptr %arr, ptr %a_len_ptr) {
; CHECK: test_01(
; CHECK: entry:
-; CHECK-NEXT: %exit.mainloop.at = load i32, i32* %a_len_ptr
+; CHECK-NEXT: %exit.mainloop.at = load i32, ptr %a_len_ptr
; CHECK: loop:
; CHECK-NEXT: %idx = phi i32 [ %idx.next, %in.bounds ], [ 0, %loop.preheader ]
; CHECK-NEXT: %idx.next = add i32 %idx, 1
; CHECK-NEXT: %abc = icmp slt i32 %idx, %exit.mainloop.at
; CHECK-NEXT: br i1 true, label %in.bounds,
; CHECK: in.bounds:
-; CHECK-NEXT: %addr = getelementptr i32, i32* %arr, i32 %idx
-; CHECK-NEXT: store i32 0, i32* %addr
+; CHECK-NEXT: %addr = getelementptr i32, ptr %arr, i32 %idx
+; CHECK-NEXT: store i32 0, ptr %addr
; CHECK-NEXT: %next = icmp slt i32 %idx.next, 2147483647
; CHECK-NEXT: [[COND:%[^ ]+]] = icmp slt i32 %idx.next, %exit.mainloop.at
; CHECK-NEXT: br i1 [[COND]], label %loop, label %main.exit.selector
; CHECK-NEXT: %abc.postloop = icmp slt i32 %idx.postloop, %exit.mainloop.at
; CHECK-NEXT: br i1 %abc.postloop, label %in.bounds.postloop, label %out.of.bounds.loopexit
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: %addr.postloop = getelementptr i32, i32* %arr, i32 %idx.postloop
-; CHECK-NEXT: store i32 0, i32* %addr.postloop
+; CHECK-NEXT: %addr.postloop = getelementptr i32, ptr %arr, i32 %idx.postloop
+; CHECK-NEXT: store i32 0, ptr %addr.postloop
; CHECK-NEXT: %next.postloop = icmp slt i32 %idx.next.postloop, 2147483647
; CHECK-NEXT: br i1 %next.postloop, label %loop.postloop, label %exit.loopexit
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, 2147483647
br i1 %next, label %loop, label %exit
}
; Iterate from SINT_MAX to 0, check that the pre-loop is generated.
-define void @test_02(i32* %arr, i32* %a_len_ptr) {
+define void @test_02(ptr %arr, ptr %a_len_ptr) {
; CHECK: test_02(
; CHECK: entry:
-; CHECK-NEXT: %len = load i32, i32* %a_len_ptr, align 4, !range !0
+; CHECK-NEXT: %len = load i32, ptr %a_len_ptr, align 4, !range !0
; CHECK-NEXT: br i1 true, label %loop.preloop.preheader
; CHECK: mainloop:
; CHECK-NEXT: br label %loop
; CHECK-NEXT: %abc = icmp slt i32 %idx, %len
; CHECK-NEXT: br i1 true, label %in.bounds
; CHECK: in.bounds:
-; CHECK-NEXT: %addr = getelementptr i32, i32* %arr, i32 %idx
-; CHECK-NEXT: store i32 0, i32* %addr
+; CHECK-NEXT: %addr = getelementptr i32, ptr %arr, i32 %idx
+; CHECK-NEXT: store i32 0, ptr %addr
; CHECK-NEXT: %next = icmp sgt i32 %idx.next, -1
; CHECK-NEXT: br i1 %next, label %loop, label %exit.loopexit
; CHECK: loop.preloop:
; CHECK-NEXT: %abc.preloop = icmp slt i32 %idx.preloop, %len
; CHECK-NEXT: br i1 %abc.preloop, label %in.bounds.preloop, label %out.of.bounds.loopexit
; CHECK: in.bounds.preloop:
-; CHECK-NEXT: %addr.preloop = getelementptr i32, i32* %arr, i32 %idx.preloop
-; CHECK-NEXT: store i32 0, i32* %addr.preloop
+; CHECK-NEXT: %addr.preloop = getelementptr i32, ptr %arr, i32 %idx.preloop
+; CHECK-NEXT: store i32 0, ptr %addr.preloop
; CHECK-NEXT: %next.preloop = icmp sgt i32 %idx.next.preloop, -1
; CHECK-NEXT: [[COND:%[^ ]+]] = icmp sgt i32 %idx.next.preloop, -1
; CHECK-NEXT: br i1 [[COND]], label %loop.preloop, label %preloop.exit.selector
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp sgt i32 %idx.next, -1
br i1 %next, label %loop, label %exit
; We can also properly eliminate range check against %n which is not always
; known positive.
-define void @test_04(i32* %p) {
+define void @test_04(ptr %p) {
; CHECK-LABEL: test_04
; CHECK: entry
; CHECK: postloop:
entry:
- %n = load i32, i32* %p
+ %n = load i32, ptr %p
br label %loop_header
loop_header: ; preds = %loop_latch, %entry
; Same as test_04, but range guarantees that %n is positive. So we can safely
; intersect ranges (with insertion of postloop).
-define void @test_05(i32* %p) {
+define void @test_05(ptr %p) {
; CHECK-LABEL: test_05
; CHECK-NOT: preloop
; CHECK: entry:
-; CHECK-NEXT: %n = load i32, i32* %p, align 4, !range !
+; CHECK-NEXT: %n = load i32, ptr %p, align 4, !range !
; CHECK-NEXT: %exit.mainloop.at = call i32 @llvm.umax.i32(i32 %n, i32 2)
; CHECK-NEXT: [[CMP_2:%[^ ]+]] = icmp ult i32 2, %exit.mainloop.at
; CHECK-NEXT: br i1 [[CMP_2]], label %loop_header.preheader, label %main.pseudo.exit
; CHECK-NEXT: br i1 %loop_cond.postloop, label %loop_header.postloop, label %exit.loopexit
entry:
- %n = load i32, i32* %p, !range !0
+ %n = load i32, ptr %p, !range !0
br label %loop_header
loop_header: ; preds = %loop_latch, %entry
; %len = SINT_MAX
; %exit.mainloop.at = 101
-define void @test_01(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_01(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK-LABEL: @test_01(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[LEN:%.*]] = load i32, i32* [[A_LEN_PTR:%.*]], align 4, !range [[RNG0:![0-9]+]]
+; CHECK-NEXT: [[LEN:%.*]] = load i32, ptr [[A_LEN_PTR:%.*]], align 4, !range [[RNG0:![0-9]+]]
; CHECK-NEXT: [[TMP0:%.*]] = add nsw i32 [[LEN]], -13
; CHECK-NEXT: [[SMIN:%.*]] = call i32 @llvm.smin.i32(i32 [[TMP0]], i32 101)
; CHECK-NEXT: [[EXIT_MAINLOOP_AT:%.*]] = call i32 @llvm.smax.i32(i32 [[SMIN]], i32 0)
; CHECK-NEXT: [[ABC:%.*]] = icmp ult i32 [[IDX_OFFSET]], [[LEN]]
; CHECK-NEXT: br i1 true, label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS_LOOPEXIT1:%.*]]
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, i32* [[ARR:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp slt i32 [[IDX_NEXT]], 101
; CHECK-NEXT: [[TMP2:%.*]] = icmp slt i32 [[IDX_NEXT]], [[EXIT_MAINLOOP_AT]]
; CHECK-NEXT: br i1 [[TMP2]], label [[LOOP]], label [[MAIN_EXIT_SELECTOR:%.*]]
; CHECK-NEXT: [[ABC_POSTLOOP:%.*]] = icmp ult i32 [[IDX_OFFSET_POSTLOOP]], [[LEN]]
; CHECK-NEXT: br i1 [[ABC_POSTLOOP]], label [[IN_BOUNDS_POSTLOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT:%.*]]
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, i32* [[ARR]], i32 [[IDX_POSTLOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX_POSTLOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_POSTLOOP]], align 4
; CHECK-NEXT: [[NEXT_POSTLOOP:%.*]] = icmp slt i32 [[IDX_NEXT_POSTLOOP]], 101
; CHECK-NEXT: br i1 [[NEXT_POSTLOOP]], label [[LOOP_POSTLOOP]], label [[EXIT_LOOPEXIT:%.*]], !llvm.loop [[LOOP1:![0-9]+]], !irce.loop.clone !6
;
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, 101
br i1 %next, label %loop, label %exit
; %len = SINT_MAX
; %exit.mainloop.at = 101
-define void @test_02(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_02(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK-LABEL: @test_02(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[LEN:%.*]] = load i32, i32* [[A_LEN_PTR:%.*]], align 4, !range [[RNG0]]
+; CHECK-NEXT: [[LEN:%.*]] = load i32, ptr [[A_LEN_PTR:%.*]], align 4, !range [[RNG0]]
; CHECK-NEXT: [[TMP0:%.*]] = add nuw nsw i32 [[LEN]], -2147483647
; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[TMP0]], i32 -13)
; CHECK-NEXT: [[TMP1:%.*]] = sub i32 [[LEN]], [[SMAX]]
; CHECK-NEXT: [[ABC:%.*]] = icmp ult i32 [[IDX_OFFSET]], [[LEN]]
; CHECK-NEXT: br i1 true, label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS_LOOPEXIT3:%.*]]
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, i32* [[ARR:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp slt i32 [[IDX_NEXT]], 101
; CHECK-NEXT: [[TMP3:%.*]] = icmp slt i32 [[IDX_NEXT]], [[EXIT_MAINLOOP_AT]]
; CHECK-NEXT: br i1 [[TMP3]], label [[LOOP]], label [[MAIN_EXIT_SELECTOR:%.*]]
; CHECK-NEXT: [[ABC_PRELOOP:%.*]] = icmp ult i32 [[IDX_OFFSET_PRELOOP]], [[LEN]]
; CHECK-NEXT: br i1 [[ABC_PRELOOP]], label [[IN_BOUNDS_PRELOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT:%.*]]
; CHECK: in.bounds.preloop:
-; CHECK-NEXT: [[ADDR_PRELOOP:%.*]] = getelementptr i32, i32* [[ARR]], i32 [[IDX_PRELOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_PRELOOP]], align 4
+; CHECK-NEXT: [[ADDR_PRELOOP:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX_PRELOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_PRELOOP]], align 4
; CHECK-NEXT: [[NEXT_PRELOOP:%.*]] = icmp slt i32 [[IDX_NEXT_PRELOOP]], 101
; CHECK-NEXT: [[TMP5:%.*]] = icmp slt i32 [[IDX_NEXT_PRELOOP]], 13
; CHECK-NEXT: br i1 [[TMP5]], label [[LOOP_PRELOOP]], label [[PRELOOP_EXIT_SELECTOR:%.*]], !llvm.loop [[LOOP7:![0-9]+]], !irce.loop.clone !6
; CHECK-NEXT: [[ABC_POSTLOOP:%.*]] = icmp ult i32 [[IDX_OFFSET_POSTLOOP]], [[LEN]]
; CHECK-NEXT: br i1 [[ABC_POSTLOOP]], label [[IN_BOUNDS_POSTLOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT2:%.*]]
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, i32* [[ARR]], i32 [[IDX_POSTLOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX_POSTLOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_POSTLOOP]], align 4
; CHECK-NEXT: [[NEXT_POSTLOOP:%.*]] = icmp slt i32 [[IDX_NEXT_POSTLOOP]], 101
; CHECK-NEXT: br i1 [[NEXT_POSTLOOP]], label [[LOOP_POSTLOOP]], label [[EXIT_LOOPEXIT:%.*]], !llvm.loop [[LOOP8:![0-9]+]], !irce.loop.clone !6
;
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, 101
br i1 %next, label %loop, label %exit
; %len = SINT_MAX
; %exit.mainloop.at = 101
-define void @test_03(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_03(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK-LABEL: @test_03(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[LEN:%.*]] = load i32, i32* [[A_LEN_PTR:%.*]], align 4, !range [[RNG0]]
+; CHECK-NEXT: [[LEN:%.*]] = load i32, ptr [[A_LEN_PTR:%.*]], align 4, !range [[RNG0]]
; CHECK-NEXT: [[SMIN:%.*]] = call i32 @llvm.smin.i32(i32 [[LEN]], i32 13)
; CHECK-NEXT: [[TMP0:%.*]] = sub i32 [[LEN]], [[SMIN]]
; CHECK-NEXT: [[EXIT_MAINLOOP_AT:%.*]] = call i32 @llvm.umin.i32(i32 [[TMP0]], i32 101)
; CHECK-NEXT: [[ABC:%.*]] = icmp slt i32 [[IDX_OFFSET]], [[LEN]]
; CHECK-NEXT: br i1 true, label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS_LOOPEXIT1:%.*]]
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, i32* [[ARR:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp ult i32 [[IDX_NEXT]], 101
; CHECK-NEXT: [[TMP2:%.*]] = icmp ult i32 [[IDX_NEXT]], [[EXIT_MAINLOOP_AT]]
; CHECK-NEXT: br i1 [[TMP2]], label [[LOOP]], label [[MAIN_EXIT_SELECTOR:%.*]]
; CHECK-NEXT: [[ABC_POSTLOOP:%.*]] = icmp slt i32 [[IDX_OFFSET_POSTLOOP]], [[LEN]]
; CHECK-NEXT: br i1 [[ABC_POSTLOOP]], label [[IN_BOUNDS_POSTLOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT:%.*]]
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, i32* [[ARR]], i32 [[IDX_POSTLOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX_POSTLOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_POSTLOOP]], align 4
; CHECK-NEXT: [[NEXT_POSTLOOP:%.*]] = icmp ult i32 [[IDX_NEXT_POSTLOOP]], 101
; CHECK-NEXT: br i1 [[NEXT_POSTLOOP]], label [[LOOP_POSTLOOP]], label [[EXIT_LOOPEXIT:%.*]], !llvm.loop [[LOOP9:![0-9]+]], !irce.loop.clone !6
;
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ult i32 %idx.next, 101
br i1 %next, label %loop, label %exit
; %len = SINT_MAX
; %exit.mainloop.at = 101
-define void @test_04(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_04(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK-LABEL: @test_04(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[LEN:%.*]] = load i32, i32* [[A_LEN_PTR:%.*]], align 4, !range [[RNG0]]
+; CHECK-NEXT: [[LEN:%.*]] = load i32, ptr [[A_LEN_PTR:%.*]], align 4, !range [[RNG0]]
; CHECK-NEXT: [[TMP0:%.*]] = add nuw i32 [[LEN]], 13
; CHECK-NEXT: [[EXIT_MAINLOOP_AT:%.*]] = call i32 @llvm.umin.i32(i32 [[TMP0]], i32 101)
; CHECK-NEXT: br i1 true, label [[LOOP_PRELOOP_PREHEADER:%.*]], label [[PRELOOP_PSEUDO_EXIT:%.*]]
; CHECK-NEXT: [[ABC:%.*]] = icmp slt i32 [[IDX_OFFSET]], [[LEN]]
; CHECK-NEXT: br i1 true, label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS_LOOPEXIT3:%.*]]
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, i32* [[ARR:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp ult i32 [[IDX_NEXT]], 101
; CHECK-NEXT: [[TMP2:%.*]] = icmp ult i32 [[IDX_NEXT]], [[EXIT_MAINLOOP_AT]]
; CHECK-NEXT: br i1 [[TMP2]], label [[LOOP]], label [[MAIN_EXIT_SELECTOR:%.*]]
; CHECK-NEXT: [[ABC_PRELOOP:%.*]] = icmp slt i32 [[IDX_OFFSET_PRELOOP]], [[LEN]]
; CHECK-NEXT: br i1 [[ABC_PRELOOP]], label [[IN_BOUNDS_PRELOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT:%.*]]
; CHECK: in.bounds.preloop:
-; CHECK-NEXT: [[ADDR_PRELOOP:%.*]] = getelementptr i32, i32* [[ARR]], i32 [[IDX_PRELOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_PRELOOP]], align 4
+; CHECK-NEXT: [[ADDR_PRELOOP:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX_PRELOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_PRELOOP]], align 4
; CHECK-NEXT: [[NEXT_PRELOOP:%.*]] = icmp ult i32 [[IDX_NEXT_PRELOOP]], 101
; CHECK-NEXT: [[TMP4:%.*]] = icmp ult i32 [[IDX_NEXT_PRELOOP]], 13
; CHECK-NEXT: br i1 [[TMP4]], label [[LOOP_PRELOOP]], label [[PRELOOP_EXIT_SELECTOR:%.*]], !llvm.loop [[LOOP10:![0-9]+]], !irce.loop.clone !6
; CHECK-NEXT: [[ABC_POSTLOOP:%.*]] = icmp slt i32 [[IDX_OFFSET_POSTLOOP]], [[LEN]]
; CHECK-NEXT: br i1 [[ABC_POSTLOOP]], label [[IN_BOUNDS_POSTLOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT2:%.*]]
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, i32* [[ARR]], i32 [[IDX_POSTLOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX_POSTLOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_POSTLOOP]], align 4
; CHECK-NEXT: [[NEXT_POSTLOOP:%.*]] = icmp ult i32 [[IDX_NEXT_POSTLOOP]], 101
; CHECK-NEXT: br i1 [[NEXT_POSTLOOP]], label [[LOOP_POSTLOOP]], label [[EXIT_LOOPEXIT:%.*]], !llvm.loop [[LOOP11:![0-9]+]], !irce.loop.clone !6
;
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ult i32 %idx.next, 101
br i1 %next, label %loop, label %exit
}
; Signed latch, signed RC, positive offset. Same as test_01.
-define void @test_05(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_05(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK-LABEL: @test_05(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[LEN:%.*]] = load i32, i32* [[A_LEN_PTR:%.*]], align 4, !range [[RNG0]]
+; CHECK-NEXT: [[LEN:%.*]] = load i32, ptr [[A_LEN_PTR:%.*]], align 4, !range [[RNG0]]
; CHECK-NEXT: [[TMP0:%.*]] = add nsw i32 [[LEN]], -13
; CHECK-NEXT: [[SMIN:%.*]] = call i32 @llvm.smin.i32(i32 [[TMP0]], i32 101)
; CHECK-NEXT: [[EXIT_MAINLOOP_AT:%.*]] = call i32 @llvm.smax.i32(i32 [[SMIN]], i32 0)
; CHECK-NEXT: [[ABC:%.*]] = icmp slt i32 [[IDX_OFFSET]], [[LEN]]
; CHECK-NEXT: br i1 true, label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS_LOOPEXIT1:%.*]]
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, i32* [[ARR:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp slt i32 [[IDX_NEXT]], 101
; CHECK-NEXT: [[TMP2:%.*]] = icmp slt i32 [[IDX_NEXT]], [[EXIT_MAINLOOP_AT]]
; CHECK-NEXT: br i1 [[TMP2]], label [[LOOP]], label [[MAIN_EXIT_SELECTOR:%.*]]
; CHECK-NEXT: [[ABC_POSTLOOP:%.*]] = icmp slt i32 [[IDX_OFFSET_POSTLOOP]], [[LEN]]
; CHECK-NEXT: br i1 [[ABC_POSTLOOP]], label [[IN_BOUNDS_POSTLOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT:%.*]]
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, i32* [[ARR]], i32 [[IDX_POSTLOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX_POSTLOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_POSTLOOP]], align 4
; CHECK-NEXT: [[NEXT_POSTLOOP:%.*]] = icmp slt i32 [[IDX_NEXT_POSTLOOP]], 101
; CHECK-NEXT: br i1 [[NEXT_POSTLOOP]], label [[LOOP_POSTLOOP]], label [[EXIT_LOOPEXIT:%.*]], !llvm.loop [[LOOP12:![0-9]+]], !irce.loop.clone !6
;
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, 101
br i1 %next, label %loop, label %exit
}
; Signed latch, signed RC, negative offset. Same as test_02.
-define void @test_06(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_06(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK-LABEL: @test_06(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[LEN:%.*]] = load i32, i32* [[A_LEN_PTR:%.*]], align 4, !range [[RNG0]]
+; CHECK-NEXT: [[LEN:%.*]] = load i32, ptr [[A_LEN_PTR:%.*]], align 4, !range [[RNG0]]
; CHECK-NEXT: [[TMP0:%.*]] = add nuw nsw i32 [[LEN]], -2147483647
; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[TMP0]], i32 -13)
; CHECK-NEXT: [[TMP1:%.*]] = sub i32 [[LEN]], [[SMAX]]
; CHECK-NEXT: [[ABC:%.*]] = icmp slt i32 [[IDX_OFFSET]], [[LEN]]
; CHECK-NEXT: br i1 true, label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS_LOOPEXIT3:%.*]]
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, i32* [[ARR:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp slt i32 [[IDX_NEXT]], 101
; CHECK-NEXT: [[TMP3:%.*]] = icmp slt i32 [[IDX_NEXT]], [[EXIT_MAINLOOP_AT]]
; CHECK-NEXT: br i1 [[TMP3]], label [[LOOP]], label [[MAIN_EXIT_SELECTOR:%.*]]
; CHECK-NEXT: [[ABC_PRELOOP:%.*]] = icmp slt i32 [[IDX_OFFSET_PRELOOP]], [[LEN]]
; CHECK-NEXT: br i1 [[ABC_PRELOOP]], label [[IN_BOUNDS_PRELOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT:%.*]]
; CHECK: in.bounds.preloop:
-; CHECK-NEXT: [[ADDR_PRELOOP:%.*]] = getelementptr i32, i32* [[ARR]], i32 [[IDX_PRELOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_PRELOOP]], align 4
+; CHECK-NEXT: [[ADDR_PRELOOP:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX_PRELOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_PRELOOP]], align 4
; CHECK-NEXT: [[NEXT_PRELOOP:%.*]] = icmp slt i32 [[IDX_NEXT_PRELOOP]], 101
; CHECK-NEXT: [[TMP5:%.*]] = icmp slt i32 [[IDX_NEXT_PRELOOP]], 13
; CHECK-NEXT: br i1 [[TMP5]], label [[LOOP_PRELOOP]], label [[PRELOOP_EXIT_SELECTOR:%.*]], !llvm.loop [[LOOP13:![0-9]+]], !irce.loop.clone !6
; CHECK-NEXT: [[ABC_POSTLOOP:%.*]] = icmp slt i32 [[IDX_OFFSET_POSTLOOP]], [[LEN]]
; CHECK-NEXT: br i1 [[ABC_POSTLOOP]], label [[IN_BOUNDS_POSTLOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT2:%.*]]
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, i32* [[ARR]], i32 [[IDX_POSTLOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX_POSTLOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_POSTLOOP]], align 4
; CHECK-NEXT: [[NEXT_POSTLOOP:%.*]] = icmp slt i32 [[IDX_NEXT_POSTLOOP]], 101
; CHECK-NEXT: br i1 [[NEXT_POSTLOOP]], label [[LOOP_POSTLOOP]], label [[EXIT_LOOPEXIT:%.*]], !llvm.loop [[LOOP14:![0-9]+]], !irce.loop.clone !6
;
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, 101
br i1 %next, label %loop, label %exit
}
; Unsigned latch, Unsigned RC, negative offset. Same as test_03.
-define void @test_07(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_07(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK-LABEL: @test_07(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[LEN:%.*]] = load i32, i32* [[A_LEN_PTR:%.*]], align 4, !range [[RNG0]]
+; CHECK-NEXT: [[LEN:%.*]] = load i32, ptr [[A_LEN_PTR:%.*]], align 4, !range [[RNG0]]
; CHECK-NEXT: [[SMIN:%.*]] = call i32 @llvm.smin.i32(i32 [[LEN]], i32 13)
; CHECK-NEXT: [[TMP0:%.*]] = sub i32 [[LEN]], [[SMIN]]
; CHECK-NEXT: [[EXIT_MAINLOOP_AT:%.*]] = call i32 @llvm.umin.i32(i32 [[TMP0]], i32 101)
; CHECK-NEXT: [[ABC:%.*]] = icmp ult i32 [[IDX_OFFSET]], [[LEN]]
; CHECK-NEXT: br i1 true, label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS_LOOPEXIT1:%.*]]
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, i32* [[ARR:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp ult i32 [[IDX_NEXT]], 101
; CHECK-NEXT: [[TMP2:%.*]] = icmp ult i32 [[IDX_NEXT]], [[EXIT_MAINLOOP_AT]]
; CHECK-NEXT: br i1 [[TMP2]], label [[LOOP]], label [[MAIN_EXIT_SELECTOR:%.*]]
; CHECK-NEXT: [[ABC_POSTLOOP:%.*]] = icmp ult i32 [[IDX_OFFSET_POSTLOOP]], [[LEN]]
; CHECK-NEXT: br i1 [[ABC_POSTLOOP]], label [[IN_BOUNDS_POSTLOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT:%.*]]
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, i32* [[ARR]], i32 [[IDX_POSTLOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX_POSTLOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_POSTLOOP]], align 4
; CHECK-NEXT: [[NEXT_POSTLOOP:%.*]] = icmp ult i32 [[IDX_NEXT_POSTLOOP]], 101
; CHECK-NEXT: br i1 [[NEXT_POSTLOOP]], label [[LOOP_POSTLOOP]], label [[EXIT_LOOPEXIT:%.*]], !llvm.loop [[LOOP15:![0-9]+]], !irce.loop.clone !6
;
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ult i32 %idx.next, 101
br i1 %next, label %loop, label %exit
}
; Unsigned latch, Unsigned RC, negative offset. Same as test_04.
-define void @test_08(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_08(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK-LABEL: @test_08(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[LEN:%.*]] = load i32, i32* [[A_LEN_PTR:%.*]], align 4, !range [[RNG0]]
+; CHECK-NEXT: [[LEN:%.*]] = load i32, ptr [[A_LEN_PTR:%.*]], align 4, !range [[RNG0]]
; CHECK-NEXT: [[TMP0:%.*]] = add nuw i32 [[LEN]], 13
; CHECK-NEXT: [[EXIT_MAINLOOP_AT:%.*]] = call i32 @llvm.umin.i32(i32 [[TMP0]], i32 101)
; CHECK-NEXT: br i1 true, label [[LOOP_PRELOOP_PREHEADER:%.*]], label [[PRELOOP_PSEUDO_EXIT:%.*]]
; CHECK-NEXT: [[ABC:%.*]] = icmp ult i32 [[IDX_OFFSET]], [[LEN]]
; CHECK-NEXT: br i1 true, label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS_LOOPEXIT3:%.*]]
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, i32* [[ARR:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp ult i32 [[IDX_NEXT]], 101
; CHECK-NEXT: [[TMP2:%.*]] = icmp ult i32 [[IDX_NEXT]], [[EXIT_MAINLOOP_AT]]
; CHECK-NEXT: br i1 [[TMP2]], label [[LOOP]], label [[MAIN_EXIT_SELECTOR:%.*]]
; CHECK-NEXT: [[ABC_PRELOOP:%.*]] = icmp ult i32 [[IDX_OFFSET_PRELOOP]], [[LEN]]
; CHECK-NEXT: br i1 [[ABC_PRELOOP]], label [[IN_BOUNDS_PRELOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT:%.*]]
; CHECK: in.bounds.preloop:
-; CHECK-NEXT: [[ADDR_PRELOOP:%.*]] = getelementptr i32, i32* [[ARR]], i32 [[IDX_PRELOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_PRELOOP]], align 4
+; CHECK-NEXT: [[ADDR_PRELOOP:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX_PRELOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_PRELOOP]], align 4
; CHECK-NEXT: [[NEXT_PRELOOP:%.*]] = icmp ult i32 [[IDX_NEXT_PRELOOP]], 101
; CHECK-NEXT: [[TMP4:%.*]] = icmp ult i32 [[IDX_NEXT_PRELOOP]], 13
; CHECK-NEXT: br i1 [[TMP4]], label [[LOOP_PRELOOP]], label [[PRELOOP_EXIT_SELECTOR:%.*]], !llvm.loop [[LOOP16:![0-9]+]], !irce.loop.clone !6
; CHECK-NEXT: [[ABC_POSTLOOP:%.*]] = icmp ult i32 [[IDX_OFFSET_POSTLOOP]], [[LEN]]
; CHECK-NEXT: br i1 [[ABC_POSTLOOP]], label [[IN_BOUNDS_POSTLOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT2:%.*]]
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, i32* [[ARR]], i32 [[IDX_POSTLOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX_POSTLOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_POSTLOOP]], align 4
; CHECK-NEXT: [[NEXT_POSTLOOP:%.*]] = icmp ult i32 [[IDX_NEXT_POSTLOOP]], 101
; CHECK-NEXT: br i1 [[NEXT_POSTLOOP]], label [[LOOP_POSTLOOP]], label [[EXIT_LOOPEXIT:%.*]], !llvm.loop [[LOOP17:![0-9]+]], !irce.loop.clone !6
;
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ult i32 %idx.next, 101
br i1 %next, label %loop, label %exit
; CHECK: irce: in function test_03: constrained Loop
; RC against known negative value. We should not do IRCE here.
-define void @test_01(i32 *%arr, i32 %n) {
+define void @test_01(ptr %arr, i32 %n) {
; CHECK-LABEL: @test_01(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[FIRST_ITR_CHECK:%.*]] = icmp sgt i32 [[N:%.*]], 0
; CHECK-NEXT: [[ABC:%.*]] = icmp slt i32 [[IDX]], -9
; CHECK-NEXT: br i1 [[ABC]], label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS:%.*]], !prof !0
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, i32* [[ARR:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp slt i32 [[IDX_NEXT]], [[N]]
; CHECK-NEXT: br i1 [[NEXT]], label [[LOOP]], label [[EXIT_LOOPEXIT:%.*]]
; CHECK: out.of.bounds:
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !0
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
}
; Same as test_01, but the latch condition is unsigned.
-define void @test_02(i32 *%arr, i32 %n) {
+define void @test_02(ptr %arr, i32 %n) {
; CHECK-LABEL: @test_02(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[FIRST_ITR_CHECK:%.*]] = icmp sgt i32 [[N:%.*]], 0
; CHECK-NEXT: [[ABC:%.*]] = icmp slt i32 [[IDX]], -9
; CHECK-NEXT: br i1 [[ABC]], label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS:%.*]], !prof !0
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, i32* [[ARR:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp ult i32 [[IDX_NEXT]], [[N]]
; CHECK-NEXT: br i1 [[NEXT]], label [[LOOP]], label [[EXIT_LOOPEXIT:%.*]]
; CHECK: out.of.bounds:
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !0
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ult i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; RC against a value which is not known to be non-negative. Here we should
; expand runtime checks against bound being positive or negative.
-define void @test_03(i32 *%arr, i32 %n, i32 %bound) {
+define void @test_03(ptr %arr, i32 %n, i32 %bound) {
; CHECK-LABEL: @test_03(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[FIRST_ITR_CHECK:%.*]] = icmp sgt i32 [[N:%.*]], 0
; CHECK-NEXT: [[ABC:%.*]] = icmp slt i32 [[IDX]], [[BOUND]]
; CHECK-NEXT: br i1 true, label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS_LOOPEXIT5:%.*]], !prof !0
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, i32* [[ARR:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp slt i32 [[IDX_NEXT]], [[N]]
; CHECK-NEXT: [[TMP5:%.*]] = icmp slt i32 [[IDX_NEXT]], [[EXIT_MAINLOOP_AT]]
; CHECK-NEXT: br i1 [[TMP5]], label [[LOOP]], label [[MAIN_EXIT_SELECTOR:%.*]]
; CHECK-NEXT: [[ABC_POSTLOOP:%.*]] = icmp slt i32 [[IDX_POSTLOOP]], [[BOUND]]
; CHECK-NEXT: br i1 [[ABC_POSTLOOP]], label [[IN_BOUNDS_POSTLOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT:%.*]], !prof !0
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, i32* [[ARR]], i32 [[IDX_POSTLOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX_POSTLOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_POSTLOOP]], align 4
; CHECK-NEXT: [[NEXT_POSTLOOP:%.*]] = icmp slt i32 [[IDX_NEXT_POSTLOOP]], [[N]]
; CHECK-NEXT: br i1 [[NEXT_POSTLOOP]], label [[LOOP_POSTLOOP]], label [[EXIT_LOOPEXIT_LOOPEXIT:%.*]], [[LOOP1:!llvm.loop !.*]], !irce.loop.clone !6
;
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !0
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; RC against a value which is not known to be non-negative. Here we should
; expand runtime checks against bound being positive or negative.
-define void @test_04(i32 *%arr, i32 %n, i32 %bound) {
+define void @test_04(ptr %arr, i32 %n, i32 %bound) {
; CHECK-LABEL: @test_04(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[FIRST_ITR_CHECK:%.*]] = icmp sgt i32 [[N:%.*]], 0
; CHECK-NEXT: [[ABC:%.*]] = icmp slt i32 [[IDX]], [[BOUND]]
; CHECK-NEXT: br i1 true, label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS_LOOPEXIT2:%.*]], !prof !0
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, i32* [[ARR:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp ult i32 [[IDX_NEXT]], [[N]]
; CHECK-NEXT: [[TMP4:%.*]] = icmp ult i32 [[IDX_NEXT]], [[EXIT_MAINLOOP_AT]]
; CHECK-NEXT: br i1 [[TMP4]], label [[LOOP]], label [[MAIN_EXIT_SELECTOR:%.*]]
; CHECK-NEXT: [[ABC_POSTLOOP:%.*]] = icmp slt i32 [[IDX_POSTLOOP]], [[BOUND]]
; CHECK-NEXT: br i1 [[ABC_POSTLOOP]], label [[IN_BOUNDS_POSTLOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT:%.*]], !prof !0
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, i32* [[ARR]], i32 [[IDX_POSTLOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX_POSTLOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_POSTLOOP]], align 4
; CHECK-NEXT: [[NEXT_POSTLOOP:%.*]] = icmp ult i32 [[IDX_NEXT_POSTLOOP]], [[N]]
; CHECK-NEXT: br i1 [[NEXT_POSTLOOP]], label [[LOOP_POSTLOOP]], label [[EXIT_LOOPEXIT_LOOPEXIT:%.*]], [[LOOP7:!llvm.loop !.*]], !irce.loop.clone !6
;
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !0
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ult i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; FIXME: We could remove the range check here, but it does not happen due to the
; limintation we posed to fix the miscompile (see comments in the method
; computeSafeIterationSpace).
-define void @test_05(i32 *%arr, i32 %n) {
+define void @test_05(ptr %arr, i32 %n) {
; CHECK-LABEL: @test_05(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[FIRST_ITR_CHECK:%.*]] = icmp sgt i32 [[N:%.*]], 0
; CHECK-NEXT: [[ABC:%.*]] = icmp ult i32 [[IDX]], -9
; CHECK-NEXT: br i1 [[ABC]], label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS:%.*]], !prof !0
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, i32* [[ARR:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp slt i32 [[IDX_NEXT]], [[N]]
; CHECK-NEXT: br i1 [[NEXT]], label [[LOOP]], label [[EXIT_LOOPEXIT:%.*]]
; CHECK: out.of.bounds:
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !0
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; FIXME: We could remove the range check here, but it does not happen due to the
; limintation we posed to fix the miscompile (see comments in the method
; computeSafeIterationSpace).
-define void @test_06(i32 *%arr, i32 %n) {
+define void @test_06(ptr %arr, i32 %n) {
; CHECK-LABEL: @test_06(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[FIRST_ITR_CHECK:%.*]] = icmp sgt i32 [[N:%.*]], 0
; CHECK-NEXT: [[ABC:%.*]] = icmp ult i32 [[IDX]], -9
; CHECK-NEXT: br i1 [[ABC]], label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS:%.*]], !prof !0
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, i32* [[ARR:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp ult i32 [[IDX_NEXT]], [[N]]
; CHECK-NEXT: br i1 [[NEXT]], label [[LOOP]], label [[EXIT_LOOPEXIT:%.*]]
; CHECK: out.of.bounds:
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !0
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ult i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; %bound is negative (i.e. in [SINT_MAX + 1, UINT_MAX)). We should be able to
; safely remove this check (see comments in the method
; computeSafeIterationSpace).
-define void @test_07(i32 *%arr, i32 %n, i32 %bound) {
+define void @test_07(ptr %arr, i32 %n, i32 %bound) {
; CHECK-LABEL: @test_07(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[FIRST_ITR_CHECK:%.*]] = icmp sgt i32 [[N:%.*]], 0
; CHECK-NEXT: [[ABC:%.*]] = icmp ult i32 [[IDX]], [[BOUND]]
; CHECK-NEXT: br i1 true, label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS_LOOPEXIT5:%.*]], !prof !0
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, i32* [[ARR:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp slt i32 [[IDX_NEXT]], [[N]]
; CHECK-NEXT: [[TMP5:%.*]] = icmp slt i32 [[IDX_NEXT]], [[EXIT_MAINLOOP_AT]]
; CHECK-NEXT: br i1 [[TMP5]], label [[LOOP]], label [[MAIN_EXIT_SELECTOR:%.*]]
; CHECK-NEXT: [[ABC_POSTLOOP:%.*]] = icmp ult i32 [[IDX_POSTLOOP]], [[BOUND]]
; CHECK-NEXT: br i1 [[ABC_POSTLOOP]], label [[IN_BOUNDS_POSTLOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT:%.*]], !prof !0
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, i32* [[ARR]], i32 [[IDX_POSTLOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX_POSTLOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_POSTLOOP]], align 4
; CHECK-NEXT: [[NEXT_POSTLOOP:%.*]] = icmp slt i32 [[IDX_NEXT_POSTLOOP]], [[N]]
; CHECK-NEXT: br i1 [[NEXT_POSTLOOP]], label [[LOOP_POSTLOOP]], label [[EXIT_LOOPEXIT_LOOPEXIT:%.*]], [[LOOP8:!llvm.loop !.*]], !irce.loop.clone !6
;
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !0
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; %bound is negative (i.e. in [SINT_MAX + 1, UINT_MAX)). We should be able to
; safely remove this check (see comments in the method
; computeSafeIterationSpace).
-define void @test_08(i32 *%arr, i32 %n, i32 %bound) {
+define void @test_08(ptr %arr, i32 %n, i32 %bound) {
; CHECK-LABEL: @test_08(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[FIRST_ITR_CHECK:%.*]] = icmp sgt i32 [[N:%.*]], 0
; CHECK-NEXT: [[ABC:%.*]] = icmp ult i32 [[IDX]], [[BOUND]]
; CHECK-NEXT: br i1 true, label [[IN_BOUNDS]], label [[OUT_OF_BOUNDS_LOOPEXIT2:%.*]], !prof !0
; CHECK: in.bounds:
-; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, i32* [[ARR:%.*]], i32 [[IDX]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
+; CHECK-NEXT: [[ADDR:%.*]] = getelementptr i32, ptr [[ARR:%.*]], i32 [[IDX]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR]], align 4
; CHECK-NEXT: [[NEXT:%.*]] = icmp ult i32 [[IDX_NEXT]], [[N]]
; CHECK-NEXT: [[TMP4:%.*]] = icmp ult i32 [[IDX_NEXT]], [[EXIT_MAINLOOP_AT]]
; CHECK-NEXT: br i1 [[TMP4]], label [[LOOP]], label [[MAIN_EXIT_SELECTOR:%.*]]
; CHECK-NEXT: [[ABC_POSTLOOP:%.*]] = icmp ult i32 [[IDX_POSTLOOP]], [[BOUND]]
; CHECK-NEXT: br i1 [[ABC_POSTLOOP]], label [[IN_BOUNDS_POSTLOOP]], label [[OUT_OF_BOUNDS_LOOPEXIT:%.*]], !prof !0
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, i32* [[ARR]], i32 [[IDX_POSTLOOP]]
-; CHECK-NEXT: store i32 0, i32* [[ADDR_POSTLOOP]], align 4
+; CHECK-NEXT: [[ADDR_POSTLOOP:%.*]] = getelementptr i32, ptr [[ARR]], i32 [[IDX_POSTLOOP]]
+; CHECK-NEXT: store i32 0, ptr [[ADDR_POSTLOOP]], align 4
; CHECK-NEXT: [[NEXT_POSTLOOP:%.*]] = icmp ult i32 [[IDX_NEXT_POSTLOOP]], [[N]]
; CHECK-NEXT: br i1 [[NEXT_POSTLOOP]], label [[LOOP_POSTLOOP]], label [[EXIT_LOOPEXIT_LOOPEXIT:%.*]], [[LOOP9:!llvm.loop !.*]], !irce.loop.clone !6
;
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !0
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ult i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; RUN: opt -verify-loop-info -irce -S < %s | FileCheck %s
; RUN: opt -verify-loop-info -passes='require<branch-prob>,irce' -S < %s | FileCheck %s
-define void @single_access_no_preloop_no_offset(i32 *%arr, i32 *%a_len_ptr, i32 %n) {
+define void @single_access_no_preloop_no_offset(ptr %arr, ptr %a_len_ptr, i32 %n) {
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; CHECK-NEXT: br i1 %abc.postloop, label %in.bounds.postloop, label %out.of.bounds
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: %addr.postloop = getelementptr i32, i32* %arr, i32 %idx.postloop
-; CHECK-NEXT: store i32 0, i32* %addr.postloop
+; CHECK-NEXT: %addr.postloop = getelementptr i32, ptr %arr, i32 %idx.postloop
+; CHECK-NEXT: store i32 0, ptr %addr.postloop
; CHECK-NEXT: %next.postloop = icmp slt i32 %idx.next.postloop, %n
; CHECK-NEXT: br i1 %next.postloop, label %loop.postloop, label %exit.loopexit
-define void @single_access_no_preloop_with_offset(i32 *%arr, i32 *%a_len_ptr, i32 %n) {
+define void @single_access_no_preloop_with_offset(ptr %arr, ptr %a_len_ptr, i32 %n) {
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx.for.abc
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx.for.abc
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; Make sure that we do not do IRCE if we know that the safe iteration range of
; the main loop is empty.
-define void @single_access_empty_range(i32 *%arr, i32 *%a_len_ptr, i32 %n) {
+define void @single_access_empty_range(ptr %arr, ptr %a_len_ptr, i32 %n) {
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; CHECK-NOT: preloop
; CHECK-NOT: postloop
-define void @single_access_empty_range_2(i32 *%arr, i32 *%a_len_ptr, i32 %n) {
+define void @single_access_empty_range_2(ptr %arr, ptr %a_len_ptr, i32 %n) {
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %def, label %in.bounds2, label %out.of.bounds, !prof !1
in.bounds2:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; CHECK-NOT: br i1 false
; CHECK-NOT: preloop
-define void @single_access_no_preloop_no_offset_phi_len(i32 *%arr, i32 *%a_len_ptr, i32 *%b_len_ptr, i32 %n, i1 %unknown_cond) {
+define void @single_access_no_preloop_no_offset_phi_len(ptr %arr, ptr %a_len_ptr, ptr %b_len_ptr, i32 %n, i1 %unknown_cond) {
entry:
br i1 %unknown_cond, label %if.true, label %if.false
if.true:
- %len_a = load i32, i32* %a_len_ptr, !range !0
+ %len_a = load i32, ptr %a_len_ptr, !range !0
br label %merge
if.false:
- %len_b = load i32, i32* %b_len_ptr, !range !0
+ %len_b = load i32, ptr %b_len_ptr, !range !0
br label %merge
merge:
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; CHECK-NEXT: br i1 %abc.postloop, label %in.bounds.postloop, label %out.of.bounds
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: %addr.postloop = getelementptr i32, i32* %arr, i32 %idx.postloop
-; CHECK-NEXT: store i32 0, i32* %addr.postloop
+; CHECK-NEXT: %addr.postloop = getelementptr i32, ptr %arr, i32 %idx.postloop
+; CHECK-NEXT: store i32 0, ptr %addr.postloop
; CHECK-NEXT: %next.postloop = icmp slt i32 %idx.next.postloop, %n
; CHECK-NEXT: br i1 %next.postloop, label %loop.postloop, label %exit.loopexit
; RUN: opt -verify-loop-info -irce -S < %s | FileCheck %s
; RUN: opt -verify-loop-info -passes='require<branch-prob>,irce' -S < %s | FileCheck %s
-define void @single_access_with_preloop(i32 *%arr, i32 *%a_len_ptr, i32 %n, i32 %offset) {
+define void @single_access_with_preloop(ptr %arr, ptr %a_len_ptr, i32 %n, i32 %offset) {
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %array.idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %array.idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; RUN: opt -irce-skip-profitability-checks -S -verify-loop-info -irce < %s | FileCheck %s
; RUN: opt -irce-skip-profitability-checks -S -verify-loop-info -passes='require<branch-prob>,irce' < %s | FileCheck %s
-define void @single_access_no_preloop_no_offset(i32 *%arr, i32 *%a_len_ptr, i32 %n) {
+define void @single_access_no_preloop_no_offset(ptr %arr, ptr %a_len_ptr, i32 %n) {
; CHECK-LABEL: @single_access_no_preloop_no_offset(
; CHECK: main.exit.selector:
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; CHECK: irce: in function test_08: constrained Loop at depth 1 containing: %loop<header><exiting>,%in.bounds<latch><exiting>
; IV = 0; IV <s 100; IV += 7; 0 <= Len <= 50. IRCE is allowed.
-define void @test_01(i32* %arr, i32* %a_len_ptr) {
+define void @test_01(ptr %arr, ptr %a_len_ptr) {
; CHECK: @test_01(
; CHECK: entry:
-; CHECK-NEXT: %exit.mainloop.at = load i32, i32* %a_len_ptr
+; CHECK-NEXT: %exit.mainloop.at = load i32, ptr %a_len_ptr
; CHECK-NEXT: [[COND1:%[^ ]+]] = icmp slt i32 0, %exit.mainloop.at
; CHECK-NEXT: br i1 [[COND1]], label %loop.preheader, label %main.pseudo.exit
; CHECK: loop.preheader:
; CHECK-NEXT: %abc = icmp slt i32 %idx, %exit.mainloop.at
; CHECK-NEXT: br i1 true, label %in.bounds, label %out.of.bounds.loopexit1
; CHECK: in.bounds:
-; CHECK-NEXT: %addr = getelementptr i32, i32* %arr, i32 %idx
-; CHECK-NEXT: store i32 0, i32* %addr
+; CHECK-NEXT: %addr = getelementptr i32, ptr %arr, i32 %idx
+; CHECK-NEXT: store i32 0, ptr %addr
; CHECK-NEXT: %next = icmp slt i32 %idx.next, 100
; CHECK-NEXT: [[COND2:%[^ ]+]] = icmp slt i32 %idx.next, %exit.mainloop.at
; CHECK-NEXT: br i1 [[COND2]], label %loop, label %main.exit.selector
; CHECK-NEXT: %abc.postloop = icmp slt i32 %idx.postloop, %exit.mainloop.at
; CHECK-NEXT: br i1 %abc.postloop, label %in.bounds.postloop, label %out.of.bounds.loopexit
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: %addr.postloop = getelementptr i32, i32* %arr, i32 %idx.postloop
-; CHECK-NEXT: store i32 0, i32* %addr.postloop
+; CHECK-NEXT: %addr.postloop = getelementptr i32, ptr %arr, i32 %idx.postloop
+; CHECK-NEXT: store i32 0, ptr %addr.postloop
; CHECK-NEXT: %next.postloop = icmp slt i32 %idx.next.postloop, 100
; CHECK-NEXT: br i1 %next.postloop, label %loop.postloop, label %exit.loopexit
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, 100
br i1 %next, label %loop, label %exit
}
; IV = 0; IV <s MAX_INT - 7; IV += 7; 0 <= Len <= 50. IRCE is allowed.
-define void @test_02(i32* %arr, i32* %a_len_ptr) {
+define void @test_02(ptr %arr, ptr %a_len_ptr) {
; CHECK: @test_02(
; CHECK: entry:
-; CHECK-NEXT: %exit.mainloop.at = load i32, i32* %a_len_ptr
+; CHECK-NEXT: %exit.mainloop.at = load i32, ptr %a_len_ptr
; CHECK-NEXT: [[COND1:%[^ ]+]] = icmp slt i32 0, %exit.mainloop.at
; CHECK-NEXT: br i1 [[COND1]], label %loop.preheader, label %main.pseudo.exit
; CHECK: loop.preheader:
; CHECK-NEXT: %abc = icmp slt i32 %idx, %exit.mainloop.at
; CHECK-NEXT: br i1 true, label %in.bounds, label %out.of.bounds.loopexit1
; CHECK: in.bounds:
-; CHECK-NEXT: %addr = getelementptr i32, i32* %arr, i32 %idx
-; CHECK-NEXT: store i32 0, i32* %addr
+; CHECK-NEXT: %addr = getelementptr i32, ptr %arr, i32 %idx
+; CHECK-NEXT: store i32 0, ptr %addr
; CHECK-NEXT: %next = icmp slt i32 %idx.next, 2147483640
; CHECK-NEXT: [[COND2:%[^ ]+]] = icmp slt i32 %idx.next, %exit.mainloop.at
; CHECK-NEXT: br i1 [[COND2]], label %loop, label %main.exit.selector
; CHECK-NEXT: %abc.postloop = icmp slt i32 %idx.postloop, %exit.mainloop.at
; CHECK-NEXT: br i1 %abc.postloop, label %in.bounds.postloop, label %out.of.bounds.loopexit
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: %addr.postloop = getelementptr i32, i32* %arr, i32 %idx.postloop
-; CHECK-NEXT: store i32 0, i32* %addr.postloop
+; CHECK-NEXT: %addr.postloop = getelementptr i32, ptr %arr, i32 %idx.postloop
+; CHECK-NEXT: store i32 0, ptr %addr.postloop
; CHECK-NEXT: %next.postloop = icmp slt i32 %idx.next.postloop, 2147483640
; CHECK-NEXT: br i1 %next.postloop, label %loop.postloop, label %exit.loopexit
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, 2147483640
br i1 %next, label %loop, label %exit
; IV = 0; IV <s MAX_INT; IV += 7; 0 <= Len <= MAX_INT - 7. This is the greatest
; value of Len for which IRCE is allowed.
-define void @test_03(i32* %arr, i32* %a_len_ptr) {
+define void @test_03(ptr %arr, ptr %a_len_ptr) {
; CHECK: @test_03(
; CHECK: entry:
-; CHECK-NEXT: %exit.mainloop.at = load i32, i32* %a_len_ptr
+; CHECK-NEXT: %exit.mainloop.at = load i32, ptr %a_len_ptr
; CHECK-NEXT: [[COND1:%[^ ]+]] = icmp slt i32 0, %exit.mainloop.at
; CHECK-NEXT: br i1 [[COND1]], label %loop.preheader, label %main.pseudo.exit
; CHECK: loop.preheader:
; CHECK-NEXT: %abc = icmp slt i32 %idx, %exit.mainloop.at
; CHECK-NEXT: br i1 true, label %in.bounds, label %out.of.bounds.loopexit1
; CHECK: in.bounds:
-; CHECK-NEXT: %addr = getelementptr i32, i32* %arr, i32 %idx
-; CHECK-NEXT: store i32 0, i32* %addr
+; CHECK-NEXT: %addr = getelementptr i32, ptr %arr, i32 %idx
+; CHECK-NEXT: store i32 0, ptr %addr
; CHECK-NEXT: %next = icmp slt i32 %idx.next, 2147483647
; CHECK-NEXT: [[COND2:%[^ ]+]] = icmp slt i32 %idx.next, %exit.mainloop.at
; CHECK-NEXT: br i1 [[COND2]], label %loop, label %main.exit.selector
; CHECK-NEXT: %abc.postloop = icmp slt i32 %idx.postloop, %exit.mainloop.at
; CHECK-NEXT: br i1 %abc.postloop, label %in.bounds.postloop, label %out.of.bounds.loopexit
; CHECK: in.bounds.postloop:
-; CHECK-NEXT: %addr.postloop = getelementptr i32, i32* %arr, i32 %idx.postloop
-; CHECK-NEXT: store i32 0, i32* %addr.postloop
+; CHECK-NEXT: %addr.postloop = getelementptr i32, ptr %arr, i32 %idx.postloop
+; CHECK-NEXT: store i32 0, ptr %addr.postloop
; CHECK-NEXT: %next.postloop = icmp slt i32 %idx.next.postloop, 2147483647
; CHECK-NEXT: br i1 %next.postloop, label %loop.postloop, label %exit.loopexit
entry:
- %len = load i32, i32* %a_len_ptr, !range !1
+ %len = load i32, ptr %a_len_ptr, !range !1
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, 2147483647
br i1 %next, label %loop, label %exit
; IV = 0; IV <s MAX_INT; IV += 7; 0 <= Len <= MAX_INT - 6. IRCE is allowed
; because the branch would fail once idx.next == MAX_INT - 1 keeping the
; access in bounds.
-define void @test_04(i32* %arr, i32* %a_len_ptr) {
+define void @test_04(ptr %arr, ptr %a_len_ptr) {
; CHECK: @test_04(
; CHECK: loop:
; CHECK: [[IV:%[^ ]+]] = phi i32
; CHECK: br i1 [[COND_POST]], label %in.bounds.postloop, label %out.of.bounds.loopexit
entry:
- %len = load i32, i32* %a_len_ptr, !range !2
+ %len = load i32, ptr %a_len_ptr, !range !2
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, 2147483647
br i1 %next, label %loop, label %exit
}
; IV = 100; IV >s -1; IV -= 7; 0 <= Len <= 50. IRCE is allowed.
-define void @test_05(i32* %arr, i32* %a_len_ptr) {
+define void @test_05(ptr %arr, ptr %a_len_ptr) {
; CHECK: @test_05(
; CHECK: entry:
-; CHECK-NEXT: %len = load i32, i32* %a_len_ptr
+; CHECK-NEXT: %len = load i32, ptr %a_len_ptr
; CHECK-NEXT: %exit.preloop.at = add nsw i32 %len, -1
; CHECK-NEXT: [[COND1:%[^ ]+]] = icmp sgt i32 100, %exit.preloop.at
; CHECK-NEXT: br i1 [[COND1]], label %loop.preloop.preheader, label %preloop.pseudo.exit
; CHECK-NEXT: %abc = icmp slt i32 %idx, %len
; CHECK-NEXT: br i1 true, label %in.bounds, label %out.of.bounds.loopexit1
; CHECK: in.bounds:
-; CHECK-NEXT: %addr = getelementptr i32, i32* %arr, i32 %idx
-; CHECK-NEXT: store i32 0, i32* %addr
+; CHECK-NEXT: %addr = getelementptr i32, ptr %arr, i32 %idx
+; CHECK-NEXT: store i32 0, ptr %addr
; CHECK-NEXT: %next = icmp sgt i32 %idx.next, -1
; CHECK-NEXT: br i1 %next, label %loop, label %exit.loopexit
; CHECK: loop.preloop:
; CHECK-NEXT: %abc.preloop = icmp slt i32 %idx.preloop, %len
; CHECK-NEXT: br i1 %abc.preloop, label %in.bounds.preloop, label %out.of.bounds.loopexit
; CHECK: in.bounds.preloop:
-; CHECK-NEXT: %addr.preloop = getelementptr i32, i32* %arr, i32 %idx.preloop
-; CHECK-NEXT: store i32 0, i32* %addr.preloop
+; CHECK-NEXT: %addr.preloop = getelementptr i32, ptr %arr, i32 %idx.preloop
+; CHECK-NEXT: store i32 0, ptr %addr.preloop
; CHECK-NEXT: %next.preloop = icmp sgt i32 %idx.next.preloop, -1
; CHECK-NEXT: [[COND2:%[^ ]+]] = icmp sgt i32 %idx.next.preloop, %exit.preloop.at
; CHECK-NEXT: br i1 [[COND2]], label %loop.preloop, label %preloop.exit.selector
; CHECK-NEXT: br label %mainloop
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp sgt i32 %idx.next, -1
br i1 %next, label %loop, label %exit
}
; IV = MAX_INT - 7; IV >u 6; IV -= 7; 10 <= Len <= 50. IRCE is allowed.
-define void @test_06(i32* %arr, i32* %a_len_ptr) {
+define void @test_06(ptr %arr, ptr %a_len_ptr) {
; CHECK: @test_06(
; CHECK: entry:
-; CHECK-NEXT: %len = load i32, i32* %a_len_ptr
+; CHECK-NEXT: %len = load i32, ptr %a_len_ptr
; CHECK-NEXT: %exit.preloop.at = add nsw i32 %len, -1
; CHECK-NEXT: [[COND1:%[^ ]+]] = icmp ugt i32 2147483640, %exit.preloop.at
; CHECK-NEXT: br i1 [[COND1]], label %loop.preloop.preheader, label %preloop.pseudo.exit
; CHECK-NEXT: %abc = icmp slt i32 %idx, %len
; CHECK-NEXT: br i1 true, label %in.bounds, label %out.of.bounds.loopexit1
; CHECK: in.bounds:
-; CHECK-NEXT: %addr = getelementptr i32, i32* %arr, i32 %idx
-; CHECK-NEXT: store i32 0, i32* %addr
+; CHECK-NEXT: %addr = getelementptr i32, ptr %arr, i32 %idx
+; CHECK-NEXT: store i32 0, ptr %addr
; CHECK-NEXT: %next = icmp ugt i32 %idx.next, 6
; CHECK-NEXT: br i1 %next, label %loop, label %exit.loopexit
; CHECK: loop.preloop:
; CHECK-NEXT: %abc.preloop = icmp slt i32 %idx.preloop, %len
; CHECK-NEXT: br i1 %abc.preloop, label %in.bounds.preloop, label %out.of.bounds.loopexit
; CHECK: in.bounds.preloop:
-; CHECK-NEXT: %addr.preloop = getelementptr i32, i32* %arr, i32 %idx.preloop
-; CHECK-NEXT: store i32 0, i32* %addr.preloop
+; CHECK-NEXT: %addr.preloop = getelementptr i32, ptr %arr, i32 %idx.preloop
+; CHECK-NEXT: store i32 0, ptr %addr.preloop
; CHECK-NEXT: %next.preloop = icmp ugt i32 %idx.next.preloop, 6
; CHECK-NEXT: [[COND2:%[^ ]+]] = icmp ugt i32 %idx.next.preloop, %exit.preloop.at
; CHECK-NEXT: br i1 [[COND2]], label %loop.preloop, label %preloop.exit.selector
; CHECK-NEXT: br label %mainloop
entry:
- %len = load i32, i32* %a_len_ptr, !range !3
+ %len = load i32, ptr %a_len_ptr, !range !3
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ugt i32 %idx.next, 6
br i1 %next, label %loop, label %exit
; IV = MAX_INT - 7; IV >u 5; IV -= 7; 10 <= Len <= 50. IRCE is not allowed,
; because we can cross the 0 border.
-define void @test_07(i32* %arr, i32* %a_len_ptr) {
+define void @test_07(ptr %arr, ptr %a_len_ptr) {
; CHECK: @test_07(
entry:
- %len = load i32, i32* %a_len_ptr, !range !3
+ %len = load i32, ptr %a_len_ptr, !range !3
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ugt i32 %idx.next, 5
br i1 %next, label %loop, label %exit
}
; IV = MAX_INT; IV >u 6; IV -= 7; 10 <= Len <= 50. IRCE is allowed.
-define void @test_08(i32* %arr, i32* %a_len_ptr) {
+define void @test_08(ptr %arr, ptr %a_len_ptr) {
; CHECK: @test_08(
; CHECK: entry:
-; CHECK-NEXT: %len = load i32, i32* %a_len_ptr
+; CHECK-NEXT: %len = load i32, ptr %a_len_ptr
; CHECK-NEXT: %exit.preloop.at = add nsw i32 %len, -1
; CHECK-NEXT: [[COND1:%[^ ]+]] = icmp ugt i32 2147483647, %exit.preloop.at
; CHECK-NEXT: br i1 [[COND1]], label %loop.preloop.preheader, label %preloop.pseudo.exit
; CHECK-NEXT: %abc = icmp slt i32 %idx, %len
; CHECK-NEXT: br i1 true, label %in.bounds, label %out.of.bounds.loopexit1
; CHECK: in.bounds:
-; CHECK-NEXT: %addr = getelementptr i32, i32* %arr, i32 %idx
-; CHECK-NEXT: store i32 0, i32* %addr
+; CHECK-NEXT: %addr = getelementptr i32, ptr %arr, i32 %idx
+; CHECK-NEXT: store i32 0, ptr %addr
; CHECK-NEXT: %next = icmp ugt i32 %idx.next, 6
; CHECK-NEXT: br i1 %next, label %loop, label %exit.loopexit
; CHECK: loop.preloop:
; CHECK-NEXT: %abc.preloop = icmp slt i32 %idx.preloop, %len
; CHECK-NEXT: br i1 %abc.preloop, label %in.bounds.preloop, label %out.of.bounds.loopexit
; CHECK: in.bounds.preloop:
-; CHECK-NEXT: %addr.preloop = getelementptr i32, i32* %arr, i32 %idx.preloop
-; CHECK-NEXT: store i32 0, i32* %addr.preloop
+; CHECK-NEXT: %addr.preloop = getelementptr i32, ptr %arr, i32 %idx.preloop
+; CHECK-NEXT: store i32 0, ptr %addr.preloop
; CHECK-NEXT: %next.preloop = icmp ugt i32 %idx.next.preloop, 6
; CHECK-NEXT: [[COND2:%[^ ]+]] = icmp ugt i32 %idx.next.preloop, %exit.preloop.at
; CHECK-NEXT: br i1 [[COND2]], label %loop.preloop, label %preloop.exit.selector
; CHECK-NEXT: br label %mainloop
entry:
- %len = load i32, i32* %a_len_ptr, !range !3
+ %len = load i32, ptr %a_len_ptr, !range !3
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ugt i32 %idx.next, 6
br i1 %next, label %loop, label %exit
; Demonstrates that we don't currently handle the general expression
; `A * I + B'.
-define void @general_affine_expressions(i32 *%arr, i32 *%a_len_ptr, i32 %n,
+define void @general_affine_expressions(ptr %arr, ptr %a_len_ptr, i32 %n,
i32 %scale, i32 %offset) {
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %array.idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %array.idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
; Check that we do the right thing for a loop that could not be
; simplified due to an indirectbr.
-define void @multiple_latches(i32 *%arr, i32 *%a_len_ptr, i32 %n) {
+define void @multiple_latches(ptr %arr, ptr %a_len_ptr, i32 %n) {
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%n.add.1 = add i32 %n, 1
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %continue
continue:
%next2 = icmp slt i32 %idx.next, %n.add.1
- %dest = select i1 %next2, i8* blockaddress(@multiple_latches, %loop), i8* blockaddress(@multiple_latches, %exit)
- indirectbr i8* %dest, [ label %loop, label %exit]
+ %dest = select i1 %next2, ptr blockaddress(@multiple_latches, %loop), ptr blockaddress(@multiple_latches, %exit)
+ indirectbr ptr %dest, [ label %loop, label %exit]
out.of.bounds:
ret void
ret void
}
-define void @already_cloned(i32 *%arr, i32 *%a_len_ptr, i32 %n) {
+define void @already_cloned(ptr %arr, ptr %a_len_ptr, i32 %n) {
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit, !irce.loop.clone !{}
; CHECK: irce: in function test_06: constrained Loop at depth 1 containing: %loop<header><exiting>,%in.bounds<latch><exiting>
; UGT condition for increasing loop.
-define void @test_01(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_01(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_01(
; CHECK: entry:
-; CHECK-NEXT: %exit.mainloop.at = load i32, i32* %a_len_ptr, align 4, !range !0
+; CHECK-NEXT: %exit.mainloop.at = load i32, ptr %a_len_ptr, align 4, !range !0
; CHECK-NEXT: [[COND:%[^ ]+]] = icmp ult i32 0, %exit.mainloop.at
; CHECK-NEXT: br i1 [[COND]], label %loop.preheader, label %main.pseudo.exit
; CHECK: loop:
; CHECK-NEXT: br i1 %abc.postloop, label %in.bounds.postloop, label %out.of.bounds.loopexit
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ugt i32 %idx.next, 100
br i1 %next, label %exit, label %loop
}
; UGT condition for decreasing loop.
-define void @test_02(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_02(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_02(
; CHECK: entry:
-; CHECK-NEXT: %len = load i32, i32* %a_len_ptr, align 4, !range !0
+; CHECK-NEXT: %len = load i32, ptr %a_len_ptr, align 4, !range !0
; CHECK-NEXT: [[UMIN:%[^ ]+]] = call i32 @llvm.umax.i32(i32 %len, i32 1)
; CHECK-NEXT: %exit.preloop.at = add nsw i32 [[UMIN]], -1
; CHECK-NEXT: [[COND2:%[^ ]+]] = icmp ugt i32 100, %exit.preloop.at
; CHECK-NEXT: br i1 %abc.preloop, label %in.bounds.preloop, label %out.of.bounds.loopexit
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ugt i32 %idx.next, 0
br i1 %next, label %loop, label %exit
}
; Check SINT_MAX + 1, test is similar to test_01.
-define void @test_03(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_03(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_03(
; CHECK: entry:
-; CHECK-NEXT: %exit.mainloop.at = load i32, i32* %a_len_ptr, align 4, !range !0
+; CHECK-NEXT: %exit.mainloop.at = load i32, ptr %a_len_ptr, align 4, !range !0
; CHECK-NEXT: [[COND:%[^ ]+]] = icmp ult i32 0, %exit.mainloop.at
; CHECK-NEXT: br i1 [[COND]], label %loop.preheader, label %main.pseudo.exit
; CHECK: loop:
; CHECK-NEXT: br i1 %abc.postloop, label %in.bounds.postloop, label %out.of.bounds.loopexit
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ugt i32 %idx.next, 2147483648
br i1 %next, label %exit, label %loop
}
; Check SINT_MAX + 1, test is similar to test_02.
-define void @test_04(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_04(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_04(
; CHECK: entry:
-; CHECK-NEXT: %len = load i32, i32* %a_len_ptr, align 4, !range !0
+; CHECK-NEXT: %len = load i32, ptr %a_len_ptr, align 4, !range !0
; CHECK-NEXT: [[UMIN:%[^ ]+]] = call i32 @llvm.umax.i32(i32 %len, i32 1)
; CHECK-NEXT: %exit.preloop.at = add nsw i32 [[UMIN]], -1
; CHECK-NEXT: [[COND2:%[^ ]+]] = icmp ugt i32 -2147483648, %exit.preloop.at
; CHECK-NEXT: br i1 %abc.preloop, label %in.bounds.preloop, label %out.of.bounds.loopexit
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ugt i32 %idx.next, 0
br i1 %next, label %loop, label %exit
}
; Increasing loop, UINT_MAX. Negative test: we cannot add 1 to UINT_MAX.
-define void @test_05(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_05(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_05(
; CHECK-NOT: loop.preloop:
; CHECK-NOT: loop.postloop:
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ugt i32 %idx.next, 4294967295
br i1 %next, label %exit, label %loop
}
; Decreasing loop, UINT_MAX. Positive test.
-define void @test_06(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_06(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_06(
; CHECK: mainloop:
; CHECK-NEXT: br i1 %abc.preloop, label %in.bounds.preloop, label %out.of.bounds.loopexit
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ugt i32 %idx.next, 0
br i1 %next, label %loop, label %exit
; CHECK-NOT: irce: in function test_09: constrained Loop at depth 1 containing: %loop<header><exiting>,%in.bounds<latch><exiting>
; ULT condition for increasing loop.
-define void @test_01(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_01(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_01
; CHECK: entry:
-; CHECK-NEXT: %exit.mainloop.at = load i32, i32* %a_len_ptr, align 4, !range !0
+; CHECK-NEXT: %exit.mainloop.at = load i32, ptr %a_len_ptr, align 4, !range !0
; CHECK-NEXT: [[COND:%[^ ]+]] = icmp ult i32 0, %exit.mainloop.at
; CHECK-NEXT: br i1 [[COND]], label %loop.preheader, label %main.pseudo.exit
; CHECK: loop:
; CHECK-NEXT: br i1 %abc.postloop, label %in.bounds.postloop, label %out.of.bounds.loopexit
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ult i32 %idx.next, 100
br i1 %next, label %loop, label %exit
}
; ULT condition for decreasing loops.
-define void @test_02(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_02(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_02(
; CHECK: entry:
-; CHECK-NEXT: %len = load i32, i32* %a_len_ptr, align 4, !range !0
+; CHECK-NEXT: %len = load i32, ptr %a_len_ptr, align 4, !range !0
; CHECK-NEXT: [[UMIN:%[^ ]+]] = call i32 @llvm.umax.i32(i32 %len, i32 1)
; CHECK-NEXT: %exit.preloop.at = add nsw i32 [[UMIN]], -1
; CHECK-NEXT: [[COND2:%[^ ]+]] = icmp ugt i32 100, %exit.preloop.at
; CHECK-NEXT: br i1 %abc.preloop, label %in.bounds.preloop, label %out.of.bounds.loopexit
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ult i32 %idx.next, 1
br i1 %next, label %exit, label %loop
}
; Check SINT_MAX.
-define void @test_03(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_03(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_03
; CHECK: entry:
-; CHECK-NEXT: %exit.mainloop.at = load i32, i32* %a_len_ptr, align 4, !range !0
+; CHECK-NEXT: %exit.mainloop.at = load i32, ptr %a_len_ptr, align 4, !range !0
; CHECK-NEXT: [[COND:%[^ ]+]] = icmp ult i32 0, %exit.mainloop.at
; CHECK-NEXT: br i1 [[COND]], label %loop.preheader, label %main.pseudo.exit
; CHECK: loop:
; CHECK-NEXT: br i1 %abc.postloop, label %in.bounds.postloop, label %out.of.bounds.loopexit
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ult i32 %idx.next, 2147483647
br i1 %next, label %loop, label %exit
}
; Check SINT_MAX + 1, test is similar to test_01.
-define void @test_04(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_04(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_04
; CHECK: entry:
-; CHECK-NEXT: %exit.mainloop.at = load i32, i32* %a_len_ptr, align 4, !range !0
+; CHECK-NEXT: %exit.mainloop.at = load i32, ptr %a_len_ptr, align 4, !range !0
; CHECK-NEXT: [[COND:%[^ ]+]] = icmp ult i32 0, %exit.mainloop.at
; CHECK-NEXT: br i1 [[COND]], label %loop.preheader, label %main.pseudo.exit
; CHECK: loop:
; CHECK-NEXT: br i1 %abc.postloop, label %in.bounds.postloop, label %out.of.bounds.loopexit
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ult i32 %idx.next, 2147483648
br i1 %next, label %loop, label %exit
}
; Check SINT_MAX + 1, test is similar to test_02.
-define void @test_05(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_05(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_05(
; CHECK: entry:
-; CHECK-NEXT: %len = load i32, i32* %a_len_ptr, align 4, !range !0
+; CHECK-NEXT: %len = load i32, ptr %a_len_ptr, align 4, !range !0
; CHECK-NEXT: [[UMIN:%[^ ]+]] = call i32 @llvm.umax.i32(i32 %len, i32 1)
; CHECK-NEXT: %exit.preloop.at = add nsw i32 [[UMIN]], -1
; CHECK-NEXT: [[COND2:%[^ ]+]] = icmp ugt i32 -2147483648, %exit.preloop.at
; CHECK-NEXT: br i1 %abc.preloop, label %in.bounds.preloop, label %out.of.bounds.loopexit
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ult i32 %idx.next, 1
br i1 %next, label %exit, label %loop
}
; Increasing loop, UINT_MAX. Positive test.
-define void @test_06(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_06(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_06
; CHECK: entry:
-; CHECK-NEXT: %exit.mainloop.at = load i32, i32* %a_len_ptr, align 4, !range !0
+; CHECK-NEXT: %exit.mainloop.at = load i32, ptr %a_len_ptr, align 4, !range !0
; CHECK-NEXT: [[COND:%[^ ]+]] = icmp ult i32 0, %exit.mainloop.at
; CHECK-NEXT: br i1 [[COND]], label %loop.preheader, label %main.pseudo.exit
; CHECK: loop:
; CHECK-NEXT: br i1 %abc.postloop, label %in.bounds.postloop, label %out.of.bounds.loopexit
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ult i32 %idx.next, 4294967295
br i1 %next, label %loop, label %exit
}
; Decreasing loop, UINT_MAX. Negative test: we cannot substract -1 from 0.
-define void @test_07(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_07(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_07(
; CHECK-NOT: loop.preloop:
; CHECK-NOT: loop.postloop:
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ult i32 %idx.next, 0
br i1 %next, label %exit, label %loop
; Iteration space [0; UINT_MAX - 99), the fact that SINT_MAX is within this
; range does not prevent us from performing IRCE.
-define void @test_08(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_08(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_08
; CHECK: entry:
-; CHECK-NEXT: %exit.mainloop.at = load i32, i32* %a_len_ptr, align 4, !range !0
+; CHECK-NEXT: %exit.mainloop.at = load i32, ptr %a_len_ptr, align 4, !range !0
; CHECK-NEXT: [[COND:%[^ ]+]] = icmp ult i32 0, %exit.mainloop.at
; CHECK-NEXT: br i1 [[COND]], label %loop.preheader, label %main.pseudo.exit
; CHECK: loop:
; CHECK-NEXT: br i1 %abc.postloop, label %in.bounds.postloop, label %out.of.bounds.loopexit
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ult i32 %idx.next, -100
br i1 %next, label %loop, label %exit
; Walking through the border of unsigned range is not allowed
; (iteration space [-100; 100)). Negative test.
-define void @test_09(i32* %arr, i32* %a_len_ptr) #0 {
+define void @test_09(ptr %arr, ptr %a_len_ptr) #0 {
; CHECK: test_09
; CHECK-NOT: preloop
; CHECK-NOT: br i1 true
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
br label %loop
loop:
br i1 %abc, label %in.bounds, label %out.of.bounds
in.bounds:
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp ult i32 %idx.next, 100
br i1 %next, label %loop, label %exit
; CHECK: [[PSEUDO_PHI:%[^ ]+]] = phi i32 [ %inc, %for.inc ]
; CHECK: [[COND:%[^ ]+]] = icmp ult i32 [[PSEUDO_PHI]], %N
; CHECK: br i1 [[COND]], label %main.pseudo.exit, label %for.cond.cleanup.loopexit
-define void @test_inc_eq(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
+define void @test_inc_eq(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %N) {
entry:
%cmp16 = icmp sgt i32 %N, 0
br i1 %cmp16, label %for.body, label %for.cond.cleanup
for.body:
%i.017 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%cmp1 = icmp ult i32 %i.017, 512
- %arrayidx = getelementptr inbounds i32, i32* %b, i32 %i.017
- %0 = load i32, i32* %arrayidx, align 4
- %arrayidx2 = getelementptr inbounds i32, i32* %c, i32 %i.017
- %1 = load i32, i32* %arrayidx2, align 4
+ %arrayidx = getelementptr inbounds i32, ptr %b, i32 %i.017
+ %0 = load i32, ptr %arrayidx, align 4
+ %arrayidx2 = getelementptr inbounds i32, ptr %c, i32 %i.017
+ %1 = load i32, ptr %arrayidx2, align 4
br i1 %cmp1, label %if.then, label %if.else
if.then:
%sub = sub i32 %0, %1
- %arrayidx3 = getelementptr inbounds i32, i32* %a, i32 %i.017
- %2 = load i32, i32* %arrayidx3, align 4
+ %arrayidx3 = getelementptr inbounds i32, ptr %a, i32 %i.017
+ %2 = load i32, ptr %arrayidx3, align 4
%add = add nsw i32 %sub, %2
- store i32 %add, i32* %arrayidx3, align 4
+ store i32 %add, ptr %arrayidx3, align 4
br label %for.inc
if.else:
%add6 = add nsw i32 %1, %0
- %arrayidx7 = getelementptr inbounds i32, i32* %a, i32 %i.017
- store i32 %add6, i32* %arrayidx7, align 4
+ %arrayidx7 = getelementptr inbounds i32, ptr %a, i32 %i.017
+ store i32 %add6, ptr %arrayidx7, align 4
br label %for.inc
for.inc:
; CHECK: [[PSEUDO_PHI:%[^ ]+]] = phi i32 [ %inc, %for.inc ]
; CHECK: [[COND:%[^ ]+]] = icmp ult i32 [[PSEUDO_PHI]], %N
; CHECK: br i1 [[COND]], label %main.pseudo.exit, label %for.cond.cleanup.loopexit
-define void @test_inc_ne(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
+define void @test_inc_ne(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %N) {
entry:
%cmp16 = icmp sgt i32 %N, 0
br i1 %cmp16, label %for.body, label %for.cond.cleanup
for.body:
%i.017 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%cmp1 = icmp ult i32 %i.017, 512
- %arrayidx = getelementptr inbounds i32, i32* %b, i32 %i.017
- %0 = load i32, i32* %arrayidx, align 4
- %arrayidx2 = getelementptr inbounds i32, i32* %c, i32 %i.017
- %1 = load i32, i32* %arrayidx2, align 4
+ %arrayidx = getelementptr inbounds i32, ptr %b, i32 %i.017
+ %0 = load i32, ptr %arrayidx, align 4
+ %arrayidx2 = getelementptr inbounds i32, ptr %c, i32 %i.017
+ %1 = load i32, ptr %arrayidx2, align 4
br i1 %cmp1, label %if.then, label %if.else
if.then:
%sub = sub i32 %0, %1
- %arrayidx3 = getelementptr inbounds i32, i32* %a, i32 %i.017
- %2 = load i32, i32* %arrayidx3, align 4
+ %arrayidx3 = getelementptr inbounds i32, ptr %a, i32 %i.017
+ %2 = load i32, ptr %arrayidx3, align 4
%add = add nsw i32 %sub, %2
- store i32 %add, i32* %arrayidx3, align 4
+ store i32 %add, ptr %arrayidx3, align 4
br label %for.inc
if.else:
%add6 = add nsw i32 %1, %0
- %arrayidx7 = getelementptr inbounds i32, i32* %a, i32 %i.017
- store i32 %add6, i32* %arrayidx7, align 4
+ %arrayidx7 = getelementptr inbounds i32, ptr %a, i32 %i.017
+ store i32 %add6, ptr %arrayidx7, align 4
br label %for.inc
for.inc:
; CHECK: [[PSEUDO_PHI:%[^ ]+]] = phi i32 [ %inc, %for.inc ]
; CHECK: [[COND:%[^ ]+]] = icmp slt i32 [[PSEUDO_PHI]], %N
; CHECK: br i1 [[COND]], label %main.pseudo.exit, label %for.cond.cleanup.loopexit
-define void @test_inc_slt(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
+define void @test_inc_slt(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %N) {
entry:
%cmp16 = icmp sgt i32 %N, 0
br i1 %cmp16, label %for.body, label %for.cond.cleanup
for.body:
%i.017 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%cmp1 = icmp ult i32 %i.017, 512
- %arrayidx = getelementptr inbounds i32, i32* %b, i32 %i.017
- %0 = load i32, i32* %arrayidx, align 4
- %arrayidx2 = getelementptr inbounds i32, i32* %c, i32 %i.017
- %1 = load i32, i32* %arrayidx2, align 4
+ %arrayidx = getelementptr inbounds i32, ptr %b, i32 %i.017
+ %0 = load i32, ptr %arrayidx, align 4
+ %arrayidx2 = getelementptr inbounds i32, ptr %c, i32 %i.017
+ %1 = load i32, ptr %arrayidx2, align 4
br i1 %cmp1, label %if.then, label %if.else
if.then:
%sub = sub i32 %0, %1
- %arrayidx3 = getelementptr inbounds i32, i32* %a, i32 %i.017
- %2 = load i32, i32* %arrayidx3, align 4
+ %arrayidx3 = getelementptr inbounds i32, ptr %a, i32 %i.017
+ %2 = load i32, ptr %arrayidx3, align 4
%add = add nsw i32 %sub, %2
- store i32 %add, i32* %arrayidx3, align 4
+ store i32 %add, ptr %arrayidx3, align 4
br label %for.inc
if.else:
%add6 = add nsw i32 %1, %0
- %arrayidx7 = getelementptr inbounds i32, i32* %a, i32 %i.017
- store i32 %add6, i32* %arrayidx7, align 4
+ %arrayidx7 = getelementptr inbounds i32, ptr %a, i32 %i.017
+ store i32 %add6, ptr %arrayidx7, align 4
br label %for.inc
for.inc:
; CHECK: [[PSEUDO_PHI:%[^ ]+]] = phi i32 [ %inc, %for.inc ]
; CHECK: [[COND:%[^ ]+]] = icmp ult i32 [[PSEUDO_PHI]], %N
; CHECK: br i1 [[COND]], label %main.pseudo.exit, label %for.cond.cleanup.loopexit
-define void @test_inc_ult(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %N) {
+define void @test_inc_ult(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %N) {
entry:
%cmp16 = icmp ugt i32 %N, 0
br i1 %cmp16, label %for.body, label %for.cond.cleanup
for.body:
%i.017 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%cmp1 = icmp ult i32 %i.017, 512
- %arrayidx = getelementptr inbounds i32, i32* %b, i32 %i.017
- %0 = load i32, i32* %arrayidx, align 4
- %arrayidx2 = getelementptr inbounds i32, i32* %c, i32 %i.017
- %1 = load i32, i32* %arrayidx2, align 4
+ %arrayidx = getelementptr inbounds i32, ptr %b, i32 %i.017
+ %0 = load i32, ptr %arrayidx, align 4
+ %arrayidx2 = getelementptr inbounds i32, ptr %c, i32 %i.017
+ %1 = load i32, ptr %arrayidx2, align 4
br i1 %cmp1, label %if.then, label %if.else
if.then:
%sub = sub i32 %0, %1
- %arrayidx3 = getelementptr inbounds i32, i32* %a, i32 %i.017
- %2 = load i32, i32* %arrayidx3, align 4
+ %arrayidx3 = getelementptr inbounds i32, ptr %a, i32 %i.017
+ %2 = load i32, ptr %arrayidx3, align 4
%add = add nsw i32 %sub, %2
- store i32 %add, i32* %arrayidx3, align 4
+ store i32 %add, ptr %arrayidx3, align 4
br label %for.inc
if.else:
%add6 = add nsw i32 %1, %0
- %arrayidx7 = getelementptr inbounds i32, i32* %a, i32 %i.017
- store i32 %add6, i32* %arrayidx7, align 4
+ %arrayidx7 = getelementptr inbounds i32, ptr %a, i32 %i.017
+ store i32 %add6, ptr %arrayidx7, align 4
br label %for.inc
for.inc:
; CHECK: [[PSEUDO_PHI:%[^ ]+]] = phi i32 [ %dec, %for.inc ]
; CHECK: [[COND:%[^ ]+]] = icmp sgt i32 [[PSEUDO_PHI]], %M
; CHECK: br i1 [[COND]]
-define void @signed_var_imm_dec_sgt(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %M) {
+define void @signed_var_imm_dec_sgt(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %M) {
entry:
%cmp14 = icmp slt i32 %M, 1024
br i1 %cmp14, label %for.body, label %for.cond.cleanup
for.body: ; preds = %entry, %for.inc
%iv = phi i32 [ %dec, %for.inc ], [ 1024, %entry ]
%cmp1 = icmp slt i32 %iv, 1024
- %arrayidx = getelementptr inbounds i32, i32* %b, i32 %iv
- %0 = load i32, i32* %arrayidx, align 4
- %arrayidx2 = getelementptr inbounds i32, i32* %c, i32 %iv
- %1 = load i32, i32* %arrayidx2, align 4
+ %arrayidx = getelementptr inbounds i32, ptr %b, i32 %iv
+ %0 = load i32, ptr %arrayidx, align 4
+ %arrayidx2 = getelementptr inbounds i32, ptr %c, i32 %iv
+ %1 = load i32, ptr %arrayidx2, align 4
%mul = mul nsw i32 %1, %0
- %arrayidx3 = getelementptr inbounds i32, i32* %a, i32 %iv
+ %arrayidx3 = getelementptr inbounds i32, ptr %a, i32 %iv
br i1 %cmp1, label %for.inc, label %if.else
if.else: ; preds = %for.body
- %2 = load i32, i32* %arrayidx3, align 4
+ %2 = load i32, ptr %arrayidx3, align 4
%add = add nsw i32 %2, %mul
br label %for.inc
for.inc: ; preds = %for.body, %if.else
%storemerge = phi i32 [ %add, %if.else ], [ %mul, %for.body ]
- store i32 %storemerge, i32* %arrayidx3, align 4
+ store i32 %storemerge, ptr %arrayidx3, align 4
%dec = add nsw i32 %iv, -1
%cmp = icmp sgt i32 %dec, %M
br i1 %cmp, label %for.body, label %for.cond.cleanup
; CHECK: [[PSEUDO_PHI:%[^ ]+]] = phi i32 [ %iv, %for.inc ]
; CHECK: [[COND:%[^ ]+]] = icmp sgt i32 [[PSEUDO_PHI]], %M
; CHECK: br i1 [[COND]]
-define void @signed_var_imm_dec_sge(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %M) {
+define void @signed_var_imm_dec_sge(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %M) {
entry:
%cmp14 = icmp sgt i32 %M, 1024
br i1 %cmp14, label %for.cond.cleanup, label %for.body
for.body: ; preds = %entry, %for.inc
%iv = phi i32 [ %dec, %for.inc ], [ 1024, %entry ]
%cmp1 = icmp slt i32 %iv, 1024
- %arrayidx = getelementptr inbounds i32, i32* %b, i32 %iv
- %0 = load i32, i32* %arrayidx, align 4
- %arrayidx2 = getelementptr inbounds i32, i32* %c, i32 %iv
- %1 = load i32, i32* %arrayidx2, align 4
+ %arrayidx = getelementptr inbounds i32, ptr %b, i32 %iv
+ %0 = load i32, ptr %arrayidx, align 4
+ %arrayidx2 = getelementptr inbounds i32, ptr %c, i32 %iv
+ %1 = load i32, ptr %arrayidx2, align 4
%mul = mul nsw i32 %1, %0
- %arrayidx3 = getelementptr inbounds i32, i32* %a, i32 %iv
+ %arrayidx3 = getelementptr inbounds i32, ptr %a, i32 %iv
br i1 %cmp1, label %for.inc, label %if.else
if.else: ; preds = %for.body
- %2 = load i32, i32* %arrayidx3, align 4
+ %2 = load i32, ptr %arrayidx3, align 4
%add = add nsw i32 %2, %mul
br label %for.inc
for.inc: ; preds = %for.body, %if.else
%storemerge = phi i32 [ %add, %if.else ], [ %mul, %for.body ]
- store i32 %storemerge, i32* %arrayidx3, align 4
+ store i32 %storemerge, ptr %arrayidx3, align 4
%dec = add nsw i32 %iv, -1
%cmp = icmp sgt i32 %iv, %M
br i1 %cmp, label %for.body, label %for.cond.cleanup
}
-define void @signed_var_imm_dec_slt(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %M) {
+define void @signed_var_imm_dec_slt(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %M) {
entry:
%cmp14 = icmp sgt i32 %M, 1024
br i1 %cmp14, label %for.cond.cleanup, label %for.body
for.body: ; preds = %entry, %for.inc
%iv = phi i32 [ %dec, %for.inc ], [ 1024, %entry ]
%cmp1 = icmp slt i32 %iv, 1024
- %arrayidx = getelementptr inbounds i32, i32* %b, i32 %iv
- %0 = load i32, i32* %arrayidx, align 4
- %arrayidx2 = getelementptr inbounds i32, i32* %c, i32 %iv
- %1 = load i32, i32* %arrayidx2, align 4
+ %arrayidx = getelementptr inbounds i32, ptr %b, i32 %iv
+ %0 = load i32, ptr %arrayidx, align 4
+ %arrayidx2 = getelementptr inbounds i32, ptr %c, i32 %iv
+ %1 = load i32, ptr %arrayidx2, align 4
%mul = mul nsw i32 %1, %0
- %arrayidx3 = getelementptr inbounds i32, i32* %a, i32 %iv
+ %arrayidx3 = getelementptr inbounds i32, ptr %a, i32 %iv
br i1 %cmp1, label %for.inc, label %if.else
if.else: ; preds = %for.body
- %2 = load i32, i32* %arrayidx3, align 4
+ %2 = load i32, ptr %arrayidx3, align 4
%add = add nsw i32 %2, %mul
br label %for.inc
for.inc: ; preds = %for.body, %if.else
%storemerge = phi i32 [ %add, %if.else ], [ %mul, %for.body ]
- store i32 %storemerge, i32* %arrayidx3, align 4
+ store i32 %storemerge, ptr %arrayidx3, align 4
%dec = add nsw i32 %iv, -1
%cmp = icmp slt i32 %iv, %M
br i1 %cmp, label %for.cond.cleanup, label %for.body
; CHECK: [[PSEUDO_PHI:%[^ ]+]] = phi i32 [ %dec, %for.inc ]
; CHECK: [[COND:%[^ ]+]] = icmp sgt i32 [[PSEUDO_PHI]], %M
; CHECK: br i1 [[COND]]
-define void @signed_var_imm_dec_ne(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %M) {
+define void @signed_var_imm_dec_ne(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %M) {
entry:
%cmp14 = icmp slt i32 %M, 1024
br i1 %cmp14, label %for.body, label %for.cond.cleanup
for.body: ; preds = %entry, %for.inc
%iv = phi i32 [ %dec, %for.inc ], [ 1024, %entry ]
%cmp1 = icmp slt i32 %iv, 1024
- %arrayidx = getelementptr inbounds i32, i32* %b, i32 %iv
- %0 = load i32, i32* %arrayidx, align 4
- %arrayidx2 = getelementptr inbounds i32, i32* %c, i32 %iv
- %1 = load i32, i32* %arrayidx2, align 4
+ %arrayidx = getelementptr inbounds i32, ptr %b, i32 %iv
+ %0 = load i32, ptr %arrayidx, align 4
+ %arrayidx2 = getelementptr inbounds i32, ptr %c, i32 %iv
+ %1 = load i32, ptr %arrayidx2, align 4
%mul = mul nsw i32 %1, %0
- %arrayidx3 = getelementptr inbounds i32, i32* %a, i32 %iv
+ %arrayidx3 = getelementptr inbounds i32, ptr %a, i32 %iv
br i1 %cmp1, label %for.inc, label %if.else
if.else: ; preds = %for.body
- %2 = load i32, i32* %arrayidx3, align 4
+ %2 = load i32, ptr %arrayidx3, align 4
%add = add nsw i32 %2, %mul
br label %for.inc
for.inc: ; preds = %for.body, %if.else
%storemerge = phi i32 [ %add, %if.else ], [ %mul, %for.body ]
- store i32 %storemerge, i32* %arrayidx3, align 4
+ store i32 %storemerge, ptr %arrayidx3, align 4
%dec = add nsw i32 %iv, -1
%cmp = icmp ne i32 %dec, %M
br i1 %cmp, label %for.body, label %for.cond.cleanup
}
-define void @signed_var_imm_dec_eq(i32* nocapture %a, i32* nocapture readonly %b, i32* nocapture readonly %c, i32 %M) {
+define void @signed_var_imm_dec_eq(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c, i32 %M) {
entry:
%cmp14 = icmp slt i32 %M, 1024
br i1 %cmp14, label %for.body, label %for.cond.cleanup
for.body: ; preds = %entry, %for.inc
%iv = phi i32 [ %dec, %for.inc ], [ 1024, %entry ]
%cmp1 = icmp slt i32 %iv, 1024
- %arrayidx = getelementptr inbounds i32, i32* %b, i32 %iv
- %0 = load i32, i32* %arrayidx, align 4
- %arrayidx2 = getelementptr inbounds i32, i32* %c, i32 %iv
- %1 = load i32, i32* %arrayidx2, align 4
+ %arrayidx = getelementptr inbounds i32, ptr %b, i32 %iv
+ %0 = load i32, ptr %arrayidx, align 4
+ %arrayidx2 = getelementptr inbounds i32, ptr %c, i32 %iv
+ %1 = load i32, ptr %arrayidx2, align 4
%mul = mul nsw i32 %1, %0
- %arrayidx3 = getelementptr inbounds i32, i32* %a, i32 %iv
+ %arrayidx3 = getelementptr inbounds i32, ptr %a, i32 %iv
br i1 %cmp1, label %for.inc, label %if.else
if.else: ; preds = %for.body
- %2 = load i32, i32* %arrayidx3, align 4
+ %2 = load i32, ptr %arrayidx3, align 4
%add = add nsw i32 %2, %mul
br label %for.inc
for.inc: ; preds = %for.body, %if.else
%storemerge = phi i32 [ %add, %if.else ], [ %mul, %for.body ]
- store i32 %storemerge, i32* %arrayidx3, align 4
+ store i32 %storemerge, ptr %arrayidx3, align 4
%dec = add nsw i32 %iv, -1
%cmp = icmp eq i32 %dec, %M
br i1 %cmp, label %for.cond.cleanup, label %for.body
}
; General case. If both %N and %M are non-negative, we do not need a preloop.
-define i32 @test_increasing_slt_slt_wide_non-negative(i32* %n_ptr, i64* %m_ptr) {
+define i32 @test_increasing_slt_slt_wide_non-negative(ptr %n_ptr, ptr %m_ptr) {
; CHECK-LABEL: @test_increasing_slt_slt_wide_non-negative(
; CHECK-NOT: preloop
; CHECK: postloop
entry:
- %N = load i32, i32* %n_ptr, !range !2
- %M = load i64, i64* %m_ptr, !range !1
+ %N = load i32, ptr %n_ptr, !range !2
+ %M = load i64, ptr %m_ptr, !range !1
br label %loop
loop:
; General case. Even though %M may be negative, we do not need a preloop because
; we make a non-negativity runtime check against M and do not go to main loop if
; M was negative.
-define i32 @test_increasing_slt_slt_wide_general(i32* %n_ptr, i64* %m_ptr) {
+define i32 @test_increasing_slt_slt_wide_general(ptr %n_ptr, ptr %m_ptr) {
; CHECK-LABEL: @test_increasing_slt_slt_wide_general(
; CHECK-NOT: preloop
; CHECK: postloop
entry:
- %N = load i32, i32* %n_ptr, !range !2
- %M = load i64, i64* %m_ptr
+ %N = load i32, ptr %n_ptr, !range !2
+ %M = load i64, ptr %m_ptr
br label %loop
loop:
}
; General case with preloop.
-define i32 @test_increasing_slt_slt_wide_general_preloop(i32* %n_ptr, i64* %m_ptr) {
+define i32 @test_increasing_slt_slt_wide_general_preloop(ptr %n_ptr, ptr %m_ptr) {
; CHECK-LABEL: @test_increasing_slt_slt_wide_general_preloop(
; CHECK: loop:
; CHECK: postloop
entry:
- %N = load i32, i32* %n_ptr, !range !2
- %M = load i64, i64* %m_ptr
+ %N = load i32, ptr %n_ptr, !range !2
+ %M = load i64, ptr %m_ptr
br label %loop
loop:
}
; Same as above, multiple checks.
-define i32 @test_increasing_slt_slt_wide_multiple_checks(i32* %n_ptr, i64* %m1_ptr, i64* %m2_ptr, i64* %m3_ptr, i64* %m4_ptr) {
+define i32 @test_increasing_slt_slt_wide_multiple_checks(ptr %n_ptr, ptr %m1_ptr, ptr %m2_ptr, ptr %m3_ptr, ptr %m4_ptr) {
; CHECK-LABEL: @test_increasing_slt_slt_wide_multiple_checks(
; CHECK-NOT: preloop
; CHECK: loop:
; CHECK: postloop
entry:
- %N = load i32, i32* %n_ptr, !range !2
- %M1 = load i64, i64* %m1_ptr
- %M2 = load i64, i64* %m2_ptr
- %M3 = load i64, i64* %m3_ptr
- %M4 = load i64, i64* %m4_ptr
+ %N = load i32, ptr %n_ptr, !range !2
+ %M1 = load i64, ptr %m1_ptr
+ %M2 = load i64, ptr %m2_ptr
+ %M3 = load i64, ptr %m3_ptr
+ %M4 = load i64, ptr %m4_ptr
br label %loop
loop:
}
; General case. If both %N and %M are non-negative, we do not need a preloop.
-define i32 @test_increasing_ult_ult_wide_non-negative(i32* %n_ptr, i64* %m_ptr) {
+define i32 @test_increasing_ult_ult_wide_non-negative(ptr %n_ptr, ptr %m_ptr) {
; CHECK-LABEL: @test_increasing_ult_ult_wide_non-negative(
; CHECK-NOT: preloop
; CHECK: postloop
entry:
- %N = load i32, i32* %n_ptr, !range !2
- %M = load i64, i64* %m_ptr, !range !1
+ %N = load i32, ptr %n_ptr, !range !2
+ %M = load i64, ptr %m_ptr, !range !1
br label %loop
loop:
; General case. Even though %M may be negative, we do not need a preloop because
; we make a non-negativity runtime check against M and do not go to main loop if
; M was negative.
-define i32 @test_increasing_ult_ult_wide_general(i32* %n_ptr, i64* %m_ptr) {
+define i32 @test_increasing_ult_ult_wide_general(ptr %n_ptr, ptr %m_ptr) {
; CHECK-LABEL: @test_increasing_ult_ult_wide_general(
; CHECK-NOT: preloop
; CHECK: postloop
entry:
- %N = load i32, i32* %n_ptr, !range !2
- %M = load i64, i64* %m_ptr
+ %N = load i32, ptr %n_ptr, !range !2
+ %M = load i64, ptr %m_ptr
br label %loop
loop:
}
; Same as above, multiple checks.
-define i32 @test_increasing_ult_ult_wide_multiple_checks(i32* %n_ptr, i64* %m1_ptr, i64* %m2_ptr, i64* %m3_ptr, i64* %m4_ptr) {
+define i32 @test_increasing_ult_ult_wide_multiple_checks(ptr %n_ptr, ptr %m1_ptr, ptr %m2_ptr, ptr %m3_ptr, ptr %m4_ptr) {
; CHECK-LABEL: @test_increasing_ult_ult_wide_multiple_checks(
; CHECK-NOT: preloop
; CHECK: loop:
; CHECK: postloop
entry:
- %N = load i32, i32* %n_ptr, !range !2
- %M1 = load i64, i64* %m1_ptr
- %M2 = load i64, i64* %m2_ptr
- %M3 = load i64, i64* %m3_ptr
- %M4 = load i64, i64* %m4_ptr
+ %N = load i32, ptr %n_ptr, !range !2
+ %M1 = load i64, ptr %m1_ptr
+ %M2 = load i64, ptr %m2_ptr
+ %M3 = load i64, ptr %m3_ptr
+ %M4 = load i64, ptr %m4_ptr
br label %loop
loop:
; of parents, uncles and cousins.
; Function Attrs: alwaysinline
-define void @inner_loop(i32* %arr, i32* %a_len_ptr, i32 %n) #0 {
+define void @inner_loop(ptr %arr, ptr %a_len_ptr, i32 %n) #0 {
; CHECK: irce: in function inner_loop: constrained Loop at depth 1 containing: %loop<header><exiting>,%in.bounds<latch><exiting>
entry:
- %len = load i32, i32* %a_len_ptr, !range !0
+ %len = load i32, ptr %a_len_ptr, !range !0
%first.itr.check = icmp sgt i32 %n, 0
br i1 %first.itr.check, label %loop, label %exit
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
in.bounds: ; preds = %loop
- %addr = getelementptr i32, i32* %arr, i32 %idx
- store i32 0, i32* %addr
+ %addr = getelementptr i32, ptr %arr, i32 %idx
+ store i32 0, ptr %addr
%next = icmp slt i32 %idx.next, %n
br i1 %next, label %loop, label %exit
}
; Function Attrs: alwaysinline
-define void @with_parent(i32* %arr, i32* %a_len_ptr, i32 %n, i32 %parent.count) #0 {
+define void @with_parent(ptr %arr, ptr %a_len_ptr, i32 %n, i32 %parent.count) #0 {
; CHECK: irce: in function with_parent: constrained Loop at depth 2 containing: %loop.i<header><exiting>,%in.bounds.i<latch><exiting>
entry:
%idx = phi i32 [ 0, %entry ], [ %idx.next, %inner_loop.exit ]
%idx.next = add i32 %idx, 1
%next = icmp ult i32 %idx.next, %parent.count
- %len.i = load i32, i32* %a_len_ptr, !range !0
+ %len.i = load i32, ptr %a_len_ptr, !range !0
%first.itr.check.i = icmp sgt i32 %n, 0
br i1 %first.itr.check.i, label %loop.i, label %exit.i
br i1 %abc.i, label %in.bounds.i, label %out.of.bounds.i, !prof !1
in.bounds.i: ; preds = %loop.i
- %addr.i = getelementptr i32, i32* %arr, i32 %idx.i
- store i32 0, i32* %addr.i
+ %addr.i = getelementptr i32, ptr %arr, i32 %idx.i
+ store i32 0, ptr %addr.i
%next.i = icmp slt i32 %idx.next.i, %n
br i1 %next.i, label %loop.i, label %exit.i
}
; Function Attrs: alwaysinline
-define void @with_grandparent(i32* %arr, i32* %a_len_ptr, i32 %n, i32 %parent.count, i32 %grandparent.count) #0 {
+define void @with_grandparent(ptr %arr, ptr %a_len_ptr, i32 %n, i32 %parent.count, i32 %grandparent.count) #0 {
; CHECK: irce: in function with_grandparent: constrained Loop at depth 3 containing: %loop.i.i<header><exiting>,%in.bounds.i.i<latch><exiting>
entry:
%idx.i = phi i32 [ 0, %loop ], [ %idx.next.i, %inner_loop.exit.i ]
%idx.next.i = add i32 %idx.i, 1
%next.i = icmp ult i32 %idx.next.i, %parent.count
- %len.i.i = load i32, i32* %a_len_ptr, !range !0
+ %len.i.i = load i32, ptr %a_len_ptr, !range !0
%first.itr.check.i.i = icmp sgt i32 %n, 0
br i1 %first.itr.check.i.i, label %loop.i.i, label %exit.i.i
br i1 %abc.i.i, label %in.bounds.i.i, label %out.of.bounds.i.i, !prof !1
in.bounds.i.i: ; preds = %loop.i.i
- %addr.i.i = getelementptr i32, i32* %arr, i32 %idx.i.i
- store i32 0, i32* %addr.i.i
+ %addr.i.i = getelementptr i32, ptr %arr, i32 %idx.i.i
+ store i32 0, ptr %addr.i.i
%next.i.i = icmp slt i32 %idx.next.i.i, %n
br i1 %next.i.i, label %loop.i.i, label %exit.i.i
}
; Function Attrs: alwaysinline
-define void @with_sibling(i32* %arr, i32* %a_len_ptr, i32 %n, i32 %parent.count) #0 {
+define void @with_sibling(ptr %arr, ptr %a_len_ptr, i32 %n, i32 %parent.count) #0 {
; CHECK: irce: in function with_sibling: constrained Loop at depth 2 containing: %loop.i<header><exiting>,%in.bounds.i<latch><exiting>
; CHECK: irce: in function with_sibling: constrained Loop at depth 2 containing: %loop.i6<header><exiting>,%in.bounds.i9<latch><exiting>
%idx = phi i32 [ 0, %entry ], [ %idx.next, %inner_loop.exit12 ]
%idx.next = add i32 %idx, 1
%next = icmp ult i32 %idx.next, %parent.count
- %len.i = load i32, i32* %a_len_ptr, !range !0
+ %len.i = load i32, ptr %a_len_ptr, !range !0
%first.itr.check.i = icmp sgt i32 %n, 0
br i1 %first.itr.check.i, label %loop.i, label %exit.i
br i1 %abc.i, label %in.bounds.i, label %out.of.bounds.i, !prof !1
in.bounds.i: ; preds = %loop.i
- %addr.i = getelementptr i32, i32* %arr, i32 %idx.i
- store i32 0, i32* %addr.i
+ %addr.i = getelementptr i32, ptr %arr, i32 %idx.i
+ store i32 0, ptr %addr.i
%next.i = icmp slt i32 %idx.next.i, %n
br i1 %next.i, label %loop.i, label %exit.i
br label %inner_loop.exit
inner_loop.exit: ; preds = %exit.i, %out.of.bounds.i
- %len.i1 = load i32, i32* %a_len_ptr, !range !0
+ %len.i1 = load i32, ptr %a_len_ptr, !range !0
%first.itr.check.i2 = icmp sgt i32 %n, 0
br i1 %first.itr.check.i2, label %loop.i6, label %exit.i11
br i1 %abc.i5, label %in.bounds.i9, label %out.of.bounds.i10, !prof !1
in.bounds.i9: ; preds = %loop.i6
- %addr.i7 = getelementptr i32, i32* %arr, i32 %idx.i3
- store i32 0, i32* %addr.i7
+ %addr.i7 = getelementptr i32, ptr %arr, i32 %idx.i3
+ store i32 0, ptr %addr.i7
%next.i8 = icmp slt i32 %idx.next.i4, %n
br i1 %next.i8, label %loop.i6, label %exit.i11
}
; Function Attrs: alwaysinline
-define void @with_cousin(i32* %arr, i32* %a_len_ptr, i32 %n, i32 %parent.count, i32 %grandparent.count) #0 {
+define void @with_cousin(ptr %arr, ptr %a_len_ptr, i32 %n, i32 %parent.count, i32 %grandparent.count) #0 {
; CHECK: irce: in function with_cousin: constrained Loop at depth 3 containing: %loop.i.i<header><exiting>,%in.bounds.i.i<latch><exiting>
; CHECK: irce: in function with_cousin: constrained Loop at depth 3 containing: %loop.i.i10<header><exiting>,%in.bounds.i.i13<latch><exiting>
%idx.i = phi i32 [ 0, %loop ], [ %idx.next.i, %inner_loop.exit.i ]
%idx.next.i = add i32 %idx.i, 1
%next.i = icmp ult i32 %idx.next.i, %parent.count
- %len.i.i = load i32, i32* %a_len_ptr, !range !0
+ %len.i.i = load i32, ptr %a_len_ptr, !range !0
%first.itr.check.i.i = icmp sgt i32 %n, 0
br i1 %first.itr.check.i.i, label %loop.i.i, label %exit.i.i
br i1 %abc.i.i, label %in.bounds.i.i, label %out.of.bounds.i.i, !prof !1
in.bounds.i.i: ; preds = %loop.i.i
- %addr.i.i = getelementptr i32, i32* %arr, i32 %idx.i.i
- store i32 0, i32* %addr.i.i
+ %addr.i.i = getelementptr i32, ptr %arr, i32 %idx.i.i
+ store i32 0, ptr %addr.i.i
%next.i.i = icmp slt i32 %idx.next.i.i, %n
br i1 %next.i.i, label %loop.i.i, label %exit.i.i
%idx.i1 = phi i32 [ 0, %with_parent.exit ], [ %idx.next.i2, %inner_loop.exit.i16 ]
%idx.next.i2 = add i32 %idx.i1, 1
%next.i3 = icmp ult i32 %idx.next.i2, %parent.count
- %len.i.i4 = load i32, i32* %a_len_ptr, !range !0
+ %len.i.i4 = load i32, ptr %a_len_ptr, !range !0
%first.itr.check.i.i5 = icmp sgt i32 %n, 0
br i1 %first.itr.check.i.i5, label %loop.i.i10, label %exit.i.i15
br i1 %abc.i.i9, label %in.bounds.i.i13, label %out.of.bounds.i.i14, !prof !1
in.bounds.i.i13: ; preds = %loop.i.i10
- %addr.i.i11 = getelementptr i32, i32* %arr, i32 %idx.i.i7
- store i32 0, i32* %addr.i.i11
+ %addr.i.i11 = getelementptr i32, ptr %arr, i32 %idx.i.i7
+ store i32 0, ptr %addr.i.i11
%next.i.i12 = icmp slt i32 %idx.next.i.i8, %n
br i1 %next.i.i12, label %loop.i.i10, label %exit.i.i15
}
; Function Attrs: alwaysinline
-define void @with_uncle(i32* %arr, i32* %a_len_ptr, i32 %n, i32 %parent.count, i32 %grandparent.count) #0 {
+define void @with_uncle(ptr %arr, ptr %a_len_ptr, i32 %n, i32 %parent.count, i32 %grandparent.count) #0 {
; CHECK: irce: in function with_uncle: constrained Loop at depth 2 containing: %loop.i<header><exiting>,%in.bounds.i<latch><exiting>
; CHECK: irce: in function with_uncle: constrained Loop at depth 3 containing: %loop.i.i<header><exiting>,%in.bounds.i.i<latch><exiting>
%idx = phi i32 [ 0, %entry ], [ %idx.next, %with_parent.exit ]
%idx.next = add i32 %idx, 1
%next = icmp ult i32 %idx.next, %grandparent.count
- %len.i = load i32, i32* %a_len_ptr, !range !0
+ %len.i = load i32, ptr %a_len_ptr, !range !0
%first.itr.check.i = icmp sgt i32 %n, 0
br i1 %first.itr.check.i, label %loop.i, label %exit.i
br i1 %abc.i, label %in.bounds.i, label %out.of.bounds.i, !prof !1
in.bounds.i: ; preds = %loop.i
- %addr.i = getelementptr i32, i32* %arr, i32 %idx.i
- store i32 0, i32* %addr.i
+ %addr.i = getelementptr i32, ptr %arr, i32 %idx.i
+ store i32 0, ptr %addr.i
%next.i = icmp slt i32 %idx.next.i, %n
br i1 %next.i, label %loop.i, label %exit.i
%idx.i1 = phi i32 [ 0, %inner_loop.exit ], [ %idx.next.i2, %inner_loop.exit.i ]
%idx.next.i2 = add i32 %idx.i1, 1
%next.i3 = icmp ult i32 %idx.next.i2, %parent.count
- %len.i.i = load i32, i32* %a_len_ptr, !range !0
+ %len.i.i = load i32, ptr %a_len_ptr, !range !0
%first.itr.check.i.i = icmp sgt i32 %n, 0
br i1 %first.itr.check.i.i, label %loop.i.i, label %exit.i.i
br i1 %abc.i.i, label %in.bounds.i.i, label %out.of.bounds.i.i, !prof !1
in.bounds.i.i: ; preds = %loop.i.i
- %addr.i.i = getelementptr i32, i32* %arr, i32 %idx.i.i
- store i32 0, i32* %addr.i.i
+ %addr.i.i = getelementptr i32, ptr %arr, i32 %idx.i.i
+ store i32 0, ptr %addr.i.i
%next.i.i = icmp slt i32 %idx.next.i.i, %n
br i1 %next.i.i, label %loop.i.i, label %exit.i.i