xref: /llvm-project/polly/test/CodeGen/region_multiexit_partialwrite.ll (revision e1f056f692d869708c1898d9d65a69ac5584a0ed)
1; RUN: opt %loadNPMPolly '-passes=polly-import-jscop,polly-codegen' -polly-import-jscop-postfix=transformed -S < %s | FileCheck %s
2;
3; This text case has a partial write of PHI in a region-statement. It
4; requires that the new PHINode from the region's exiting block is
5; generated before before the partial memory write.
6;
7target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
8
9define void @region_multiexit_partialwrite(ptr %arg, i64 %arg1, ptr %arg2) {
10bb:
11  br label %bb3
12
13bb3:
14  %tmp = phi i64 [ %tmp17, %bb10 ], [ 1, %bb ]
15  %tmp4 = getelementptr inbounds i32, ptr %arg, i64 %tmp
16  %tmp5 = load i32, ptr %tmp4, align 4
17  %tmp6 = icmp slt i32 %tmp5, 0
18  br i1 %tmp6, label %bb7, label %bb9
19
20bb7:
21  %tmp8 = select i1 undef, i32 -2147483648, i32 undef
22  br label %bb10
23
24bb9:
25  br label %bb10
26
27bb10:
28  %tmp11 = phi i32 [ %tmp8, %bb7 ], [ undef, %bb9 ]
29  %tmp16 = getelementptr inbounds i32, ptr %arg2, i64 %tmp
30  store i32 %tmp11, ptr %tmp16, align 4
31  %tmp17 = add nuw i64 %tmp, 1
32  %tmp18 = icmp eq i64 %tmp17, %arg1
33  br i1 %tmp18, label %bb19, label %bb3
34
35bb19:
36  ret void
37}
38
39
40; CHECK:      polly.stmt.bb10.exit:
41; CHECK-NEXT:   %polly.tmp11 = phi i32 [ %p_tmp8, %polly.stmt.bb7 ], [ undef, %polly.stmt.bb9 ]
42
43; CHECK: polly.stmt.bb10.exit.Stmt_bb3__TO__bb10_Write1.partial:
44; CHECK:   store i32 %polly.tmp11
45