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; switch (A[i]) { 7; case 0: 8; A[i] += 1; 9; break; 10; case 1: 11; A[i] += 2; 12; break; 13; } 14; } 15; 16; CHECK: polly.stmt.for.body: 17; CHECK: %scevgep = getelementptr i32, i32* %A, i64 %polly.indvar 18; CHECK: %tmp1_p_scalar_ = load i32, i32* %scevgep, align 4 19; CHECK: switch i32 %tmp1_p_scalar_, label %polly.stmt.sw.epilog.exit [ 20; CHECK: i32 0, label %polly.stmt.sw.bb 21; CHECK: i32 1, label %polly.stmt.sw.bb.3 22; CHECK: ] 23; 24target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 25 26define void @f(i32* %A, i32 %N) { 27entry: 28 %tmp = sext i32 %N to i64 29 br label %for.cond 30 31for.cond: ; preds = %for.inc, %entry 32 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ] 33 %cmp = icmp slt i64 %indvars.iv, %tmp 34 br i1 %cmp, label %for.body, label %for.end 35 36for.body: ; preds = %for.cond 37 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv 38 %tmp1 = load i32, i32* %arrayidx, align 4 39 switch i32 %tmp1, label %sw.epilog [ 40 i32 0, label %sw.bb 41 i32 1, label %sw.bb.3 42 ] 43 44sw.bb: ; preds = %for.body 45 %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv 46 %tmp2 = load i32, i32* %arrayidx2, align 4 47 %add = add nsw i32 %tmp2, 1 48 store i32 %add, i32* %arrayidx2, align 4 49 br label %sw.epilog 50 51sw.bb.3: ; preds = %for.body 52 %arrayidx5 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv 53 %tmp3 = load i32, i32* %arrayidx5, align 4 54 %add6 = add nsw i32 %tmp3, 2 55 store i32 %add6, i32* %arrayidx5, align 4 56 br label %sw.epilog 57 58sw.epilog: ; preds = %sw.bb.3, %sw.bb, %for.body 59 br label %for.inc 60 61for.inc: ; preds = %sw.epilog 62 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 63 br label %for.cond 64 65for.end: ; preds = %for.cond 66 ret void 67} 68