1 ; RUN: opt %loadPolly \
2 ; RUN: -S -polly-codegen < %s | FileCheck %s
4 ; void f(int *A, int N) {
5 ; for (int i = 0; i < N; i++)
17 ; CHECK: polly.stmt.if.then:
18 ; CHECK-NEXT: %2 = trunc i64 %polly.indvar to i2
19 ; CHECK-NEXT: %3 = zext i2 %2 to i32
20 ; CHECK-NEXT: switch i32 %3, label %polly.stmt.sw.epilog [
21 ; CHECK-NEXT: i32 0, label %polly.stmt.sw.bb
22 ; CHECK-NEXT: 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 %tobool = icmp eq i32 %tmp1, 0
41 br i1 %tobool, label %if.end, label %if.then
43 if.then: ; preds = %for.body
44 %tmp2 = trunc i64 %indvars.iv to i32
45 %rem = srem i32 %tmp2, 4
46 switch i32 %rem, label %sw.epilog [
51 sw.bb: ; preds = %if.then
52 %arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
53 %tmp3 = load i32, ptr %arrayidx2, align 4
54 %add = add nsw i32 %tmp3, 1
55 store i32 %add, ptr %arrayidx2, align 4
58 sw.bb.3: ; preds = %if.then
59 %arrayidx5 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
60 %tmp4 = load i32, ptr %arrayidx5, align 4
61 %add6 = add nsw i32 %tmp4, 2
62 store i32 %add6, ptr %arrayidx5, align 4
65 sw.epilog: ; preds = %sw.bb.3, %sw.bb, %if.then
68 if.end: ; preds = %for.body, %sw.epilog
71 for.inc: ; preds = %if.end
72 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
75 for.end: ; preds = %for.cond