1 ; RUN: opt %loadNPMPolly \
2 ; RUN: -S -passes=polly-codegen < %s | FileCheck %s
4 ; void f(int *A, int N) {
5 ; for (int i = 0; i < N; i++)
16 ; CHECK: polly.stmt.for.body:
17 ; CHECK: %[[offset:.*]] = shl nuw nsw i64 %polly.indvar, 2
18 ; CHECK: %scevgep = getelementptr i8, ptr %A, i64 %[[offset]]
19 ; CHECK: %tmp1_p_scalar_ = load i32, ptr %scevgep, align 4
20 ; CHECK: switch i32 %tmp1_p_scalar_, label %polly.stmt.sw.epilog.exit [
21 ; CHECK: i32 0, label %polly.stmt.sw.bb
22 ; CHECK: i32 1, label %polly.stmt.sw.bb.3
25 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
27 define void @f(ptr %A, i32 %N) {
29 %tmp = sext i32 %N to i64
32 for.cond: ; preds = %for.inc, %entry
33 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
34 %cmp = icmp slt i64 %indvars.iv, %tmp
35 br i1 %cmp, label %for.body, label %for.end
37 for.body: ; preds = %for.cond
38 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
39 %tmp1 = load i32, ptr %arrayidx, align 4
40 switch i32 %tmp1, label %sw.epilog [
45 sw.bb: ; preds = %for.body
46 %arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
47 %tmp2 = load i32, ptr %arrayidx2, align 4
48 %add = add nsw i32 %tmp2, 1
49 store i32 %add, ptr %arrayidx2, align 4
52 sw.bb.3: ; preds = %for.body
53 %arrayidx5 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
54 %tmp3 = load i32, ptr %arrayidx5, align 4
55 %add6 = add nsw i32 %tmp3, 2
56 store i32 %add6, ptr %arrayidx5, align 4
59 sw.epilog: ; preds = %sw.bb.3, %sw.bb, %for.body
62 for.inc: ; preds = %sw.epilog
63 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
66 for.end: ; preds = %for.cond