[CodeGen] Detect impossible partial write conditions more reliably.
[polly-mirror.git] / test / Isl / CodeGen / partial_write_impossible_restriction.ll
blob2819b3174de278f21bf40b1a2e4b2ed51d9ce2b8
1 ; RUN: opt %loadPolly -polly-import-jscop -polly-import-jscop-postfix=transformed -polly-codegen -S < %s | FileCheck %s
3 ; The isl scheduler isolates %cond.false into two instances.
4 ; A partial write access in one of the instances was never executed,
5 ; which caused problems when querying for its index expression, which
6 ; is not available in that case.
8 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
10 define void @partial_write_impossible_restriction() {
11 entry:
12   br i1 undef, label %invoke.cont258, label %cond.true.i.i.i.i1007
14 cond.true.i.i.i.i1007:
15   br label %invoke.cont258
17 invoke.cont258:
18   %.pn = phi i32* [ null, %cond.true.i.i.i.i1007 ], [ null, %entry ]
19   br label %invoke.cont274
21 invoke.cont274:                                   ; preds = %invoke.cont258
22   %tmp4 = load i32*, i32** undef
23   %tmp5 = load i32, i32* undef
24   %tmp6 = zext i32 %tmp5 to i64
25   %tmp7 = sext i32 %tmp5 to i64
26   br label %for.body344
28 for.body344:                                      ; preds = %cond.end, %invoke.cont274
29   %indvars.iv1602 = phi i64 [ 0, %invoke.cont274 ], [ %indvars.iv.next1603, %cond.end ]
30   %indvars.iv.next1603 = add nuw nsw i64 %indvars.iv1602, 1
31   %cmp347 = icmp eq i64 %indvars.iv.next1603, %tmp6
32   br i1 %cmp347, label %cond.end, label %cond.false
34 cond.false:                                       ; preds = %for.body344
35   %add.ptr.i1128 = getelementptr inbounds i32, i32* %tmp4, i64 %indvars.iv.next1603
36   %cond.in.sroa.speculate.load.cond.false = load i32, i32* %add.ptr.i1128
37   br label %cond.end
39 cond.end:                                         ; preds = %cond.false, %for.body344
40   %cond.in.sroa.speculated = phi i32 [ %cond.in.sroa.speculate.load.cond.false, %cond.false ], [ undef, %for.body344 ]
41   %add.ptr.i1132 = getelementptr inbounds i32, i32* %.pn, i64 %indvars.iv1602
42   store i32 undef, i32* %add.ptr.i1132
43   %cmp342 = icmp slt i64 %indvars.iv.next1603, %tmp7
44   br i1 %cmp342, label %for.body344, label %if.then.i.i1141.loopexit
46 if.then.i.i1141.loopexit:                         ; preds = %cond.end
47   ret void
51 ; CHECK-LABEL: polly.stmt.cond.false:
52 ; CHECK:         %polly.access..pn2 = getelementptr i32, i32* %.pn, i64 %polly.indvar
53 ; CHECK:         store i32 %cond.in.sroa.speculate.load.cond.false_p_scalar_, i32* %polly.access..pn2, !alias.scope !0, !noalias !2
54 ; CHECK:         br label %polly.merge
56 ; CHECK-LABEL: polly.stmt.cond.false11:
57 ; CHECK:         %polly.access..pn14 = getelementptr i32, i32* %.pn, i64 0
58 ; CHECK:         store i32 %cond.in.sroa.speculate.load.cond.false_p_scalar_13, i32* %polly.access..pn14, !alias.scope !0, !noalias !2
59 ; CHECK:         br label %polly.stmt.cond.end15