1 ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
3 ; void f(long *A, long N, long p) {
4 ; for (long i = 0; i < N; i++)
8 ; The wrap function has no inbounds GEP but the nowrap function has. Therefore,
9 ; we will add the assumption that i+1 won't overflow only to the former.
12 ; 1152921504606846975 * sizeof(long) <= 2 ^ 63 - 1
14 ; 1152921504606846976 * sizeof(long) > 2 ^ 63 - 1
18 ; CHECK: Function: wrap
19 ; CHECK: Invalid Context:
20 ; CHECK-NEXT: [N] -> { : N >= 1152921504606846976 }
22 ; CHECK: Function: nowrap
23 ; CHECK: Invalid Context:
24 ; CHECK-NEXT: [N] -> { : 1 = 0 }
26 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
28 define void @wrap(i64* %A, i64 %N, i64 %p) {
30 %tmp31 = icmp slt i64 0, %N
31 br i1 %tmp31, label %bb4.lr.ph, label %bb8
33 bb4.lr.ph: ; preds = %bb
36 bb4: ; preds = %bb4.lr.ph, %bb7
37 %indvars.iv2 = phi i64 [ 0, %bb4.lr.ph ], [ %indvars.iv.next, %bb7 ]
38 %tmp5 = add nuw nsw i64 %indvars.iv2, 1
39 %tmp6 = getelementptr i64, i64* %A, i64 %tmp5
40 store i64 0, i64* %tmp6, align 4
44 %indvars.iv.next = add nuw nsw i64 %indvars.iv2, 1
45 %tmp3 = icmp slt i64 %indvars.iv.next, %N
46 br i1 %tmp3, label %bb4, label %bb2.bb8_crit_edge
48 bb2.bb8_crit_edge: ; preds = %bb7
51 bb8: ; preds = %bb2.bb8_crit_edge, %bb
55 define void @nowrap(i64* %A, i64 %N, i64 %p) {
57 %tmp31 = icmp slt i64 0, %N
58 br i1 %tmp31, label %bb4.lr.ph, label %bb8
60 bb4.lr.ph: ; preds = %bb
63 bb4: ; preds = %bb4.lr.ph, %bb7
64 %indvars.iv2 = phi i64 [ 0, %bb4.lr.ph ], [ %indvars.iv.next, %bb7 ]
65 %tmp5 = add nuw nsw i64 %indvars.iv2, 1
66 %tmp6 = getelementptr inbounds i64, i64* %A, i64 %tmp5
67 store i64 0, i64* %tmp6, align 4
71 %indvars.iv.next = add nuw nsw i64 %indvars.iv2, 1
72 %tmp3 = icmp slt i64 %indvars.iv.next, %N
73 br i1 %tmp3, label %bb4, label %bb2.bb8_crit_edge
75 bb2.bb8_crit_edge: ; preds = %bb7
78 bb8: ; preds = %bb2.bb8_crit_edge, %bb