1; RUN: opt %loadPolly \ 2; RUN: -S -polly-codegen < %s | FileCheck %s 3; 4; void f(int *A, int N) { 5; for (int i = 0; i < N; i++) 6; if (A[i]) 7; switch (i % 4) { 8; case 0: 9; A[i] += 1; 10; break; 11; case 1: 12; A[i] += 2; 13; break; 14; } 15; } 16; 17; CHECK: polly.stmt.if.then: 18; CHECK: %1 = trunc i64 %polly.indvar to i32 19; CHECK: %p_rem = srem i32 %1, 4 20; CHECK: switch i32 %p_rem, label %polly.stmt.sw.epilog [ 21; CHECK: i32 0, label %polly.stmt.sw.bb 22; CHECK: i32 1, label %polly.stmt.sw.bb.3 23; CHECK: ] 24; 25target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 26 27define void @f(i32* %A, i32 %N) { 28entry: 29 %tmp = sext i32 %N to i64 30 br label %for.cond 31 32for.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 36 37for.body: ; preds = %for.cond 38 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv 39 %tmp1 = load i32, i32* %arrayidx, align 4 40 %tobool = icmp eq i32 %tmp1, 0 41 br i1 %tobool, label %if.end, label %if.then 42 43if.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 [ 47 i32 0, label %sw.bb 48 i32 1, label %sw.bb.3 49 ] 50 51sw.bb: ; preds = %if.then 52 %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv 53 %tmp3 = load i32, i32* %arrayidx2, align 4 54 %add = add nsw i32 %tmp3, 1 55 store i32 %add, i32* %arrayidx2, align 4 56 br label %sw.epilog 57 58sw.bb.3: ; preds = %if.then 59 %arrayidx5 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv 60 %tmp4 = load i32, i32* %arrayidx5, align 4 61 %add6 = add nsw i32 %tmp4, 2 62 store i32 %add6, i32* %arrayidx5, align 4 63 br label %sw.epilog 64 65sw.epilog: ; preds = %sw.bb.3, %sw.bb, %if.then 66 br label %if.end 67 68if.end: ; preds = %for.body, %sw.epilog 69 br label %for.inc 70 71for.inc: ; preds = %if.end 72 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 73 br label %for.cond 74 75for.end: ; preds = %for.cond 76 ret void 77} 78