1; RUN: opt %loadPolly -polly-codegen-ppcg -polly-acc-dump-kernel-ir \
2; RUN: -disable-output < %s | \
3; RUN: FileCheck %s -check-prefix=KERNEL-IR
4
5; REQUIRES: pollyacc
6
7; Ensure that no dead instructions are emitted between the store and the
8; branch instruction of the ScopStmt. At some point, our dead-code-elimination
9; did not remove code that was inserted to compute the old (unused) branch
10; condition. This code referred to CPU registers and consequently resulted
11; in invalid bitcode.
12
13; KERNEL-IR: store i32 0, i32 addrspace(1)* %polly.access.MemRef_sum_c, align 4
14; KERNEL-IR-NEXT: br label %polly.merge
15
16target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
17target triple = "x86_64-unknown-linux-gnu"
18
19define void @kernel_dynprog([50 x [50 x i32]]* %sum_c) {
20entry:
21  br label %for.cond1.preheader
22
23for.cond1.preheader:                              ; preds = %entry
24  br label %for.body3
25
26for.cond4.for.cond1.loopexit_crit_edge:           ; preds = %for.end
27  br label %for.cond1.loopexit
28
29for.cond1.loopexit:                               ; preds = %for.cond4.for.cond1.loopexit_crit_edge
30  br i1 undef, label %for.body3, label %for.inc55
31
32for.body3:                                        ; preds = %for.cond1.loopexit, %for.cond1.preheader
33  %indvars.iv55 = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next56, %for.cond1.loopexit ]
34  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
35  br label %for.body6
36
37for.body6:                                        ; preds = %for.end, %for.body3
38  %indvars.iv50 = phi i64 [ 0, %for.body3 ], [ %indvars.iv.next51, %for.end ]
39  %arrayidx10 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %sum_c, i64 %indvars.iv55, i64 %indvars.iv50, i64 %indvars.iv55
40  store i32 0, i32* %arrayidx10, align 4
41  %cmp1334 = icmp slt i64 %indvars.iv.next56, %indvars.iv50
42  br i1 %cmp1334, label %for.body14.lr.ph, label %for.end
43
44for.body14.lr.ph:                                 ; preds = %for.body6
45  br label %for.body14
46
47for.body14:                                       ; preds = %for.body14, %for.body14.lr.ph
48  %arrayidx32 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %sum_c, i64 %indvars.iv55, i64 %indvars.iv50, i64 0
49  br i1 false, label %for.body14, label %for.cond12.for.end_crit_edge
50
51for.cond12.for.end_crit_edge:                     ; preds = %for.body14
52  br label %for.end
53
54for.end:                                          ; preds = %for.cond12.for.end_crit_edge, %for.body6
55  %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
56  %lftr.wideiv53 = trunc i64 %indvars.iv.next51 to i32
57  %exitcond54 = icmp ne i32 %lftr.wideiv53, 50
58  br i1 %exitcond54, label %for.body6, label %for.cond4.for.cond1.loopexit_crit_edge
59
60for.inc55:                                        ; preds = %for.cond1.loopexit
61  unreachable
62}
63