[Polly] Add handling of Top Level Regions
[polly-mirror.git] / test / GPGPU / remove-dead-instructions-in-stmt.ll
blob9a0a1cdd903b74b62f58162b3e296503e9d35871
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
5 ; REQUIRES: pollyacc
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.
13 ; KERNEL-IR: store i32 0, i32 addrspace(1)* %polly.access.MemRef_sum_c, align 4
14 ; KERNEL-IR-NEXT: br label %polly.merge
16 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
17 target triple = "x86_64-unknown-linux-gnu"
19 define void @kernel_dynprog([50 x [50 x i32]]* %sum_c) {
20 entry:
21   br label %for.cond1.preheader
23 for.cond1.preheader:                              ; preds = %entry
24   br label %for.body3
26 for.cond4.for.cond1.loopexit_crit_edge:           ; preds = %for.end
27   br label %for.cond1.loopexit
29 for.cond1.loopexit:                               ; preds = %for.cond4.for.cond1.loopexit_crit_edge
30   br i1 undef, label %for.body3, label %for.inc55
32 for.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
37 for.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
44 for.body14.lr.ph:                                 ; preds = %for.body6
45   br label %for.body14
47 for.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
51 for.cond12.for.end_crit_edge:                     ; preds = %for.body14
52   br label %for.end
54 for.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
60 for.inc55:                                        ; preds = %for.cond1.loopexit
61   unreachable