1 ; RUN: opt %loadPolly -polly-print-scops -disable-output < %s | FileCheck %s
3 ; void f(int *A, char N, char p) {
4 ; for (char i = 0; i < N; i++) {
9 ; The wrap function has no inbounds GEP but the nowrap function has. Therefore,
10 ; we will add the assumption that i+1 won't overflow only to the former.
12 ; CHECK: Function: wrap
13 ; CHECK: Invalid Context:
14 ; CHECK: [N] -> { : N >= 126 }
17 ; FIXME: This is a negative test as nowrap should not need an assumed context.
18 ; However %tmp5 in @nowrap is translated to the SCEV <3,+,1><nw><%bb2>
19 ; which lacks the <nsw> flags we would need to avoid runtime checks.
21 ; CHECK: Function: nowrap
22 ; CHECK: Invalid Context:
23 ; CHECK-NOT: [N] -> { : }
25 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
27 define void @wrap(ptr %A, i8 %N, i8 %p) {
31 bb2: ; preds = %bb7, %bb
32 %indvars.iv = phi i8 [ %indvars.iv.next, %bb7 ], [ 0, %bb ]
33 %tmp3 = icmp slt i8 %indvars.iv, %N
34 br i1 %tmp3, label %bb4, label %bb8
37 %tmp5 = add i8 %indvars.iv, 3
38 %tmp6 = getelementptr i32, ptr %A, i8 %tmp5
39 store i32 0, ptr %tmp6, align 4
43 %indvars.iv.next = add nsw nuw i8 %indvars.iv, 1
50 define void @nowrap(ptr %A, i8 %N, i8 %p) {
54 bb2: ; preds = %bb7, %bb
55 %indvars.iv = phi i8 [ %indvars.iv.next, %bb7 ], [ 0, %bb ]
56 %tmp3 = icmp slt i8 %indvars.iv, %N
57 br i1 %tmp3, label %bb4, label %bb8
60 %tmp5 = add nsw nuw i8 %indvars.iv, 3
61 %tmp6 = getelementptr inbounds i32, ptr %A, i8 %tmp5
62 store i32 0, ptr %tmp6, align 4
66 %indvars.iv.next = add nsw nuw i8 %indvars.iv, 1