[DeLICM] Add nomap regressions tests. NFC.
[polly-mirror.git] / test / DeLICM / nomap_writewrite.ll
blob3d2b1a47528d50996c045534448508ba65476aa2
1 ; RUN: opt %loadPolly -polly-delicm -analyze < %s | FileCheck %s
3 ;    void func(double *A) {
4 ;      for (int j = 0; j < 2; j += 1) { /* outer */
5 ;        double phi = 0.0;
6 ;        for (int i = 0; i < 4; i += 1) /* reduction */
7 ;          if (phi < 0.0)
8 ;            A[j] = undef;
9 ;          phi += 4.2;
10 ;        A[j] = phi;
11 ;      }
12 ;    }
14 ; The MAY_WRITE in reduction.for.true conflict with a write of %phi to
15 ; A[j] if %phi would be mapped to it. Being a MAY_WRITE avoids being target
16 ; of a mapping itself.
18 ; TODO: There is actually no reason why these conflict. The MAY_WRITE is an
19 ; explicit write, defined to occur always before all implicit writes as the
20 ; write of %phi would be. There is currently no differentiation between
21 ; implicit and explicit writes in Polly.
23 define void @func(double* noalias nonnull %A) {
24 entry:
25   %fsomeval = fadd double 21.0, 21.0
26   br label %outer.preheader
28 outer.preheader:
29   br label %outer.for
31 outer.for:
32   %j = phi i32 [0, %outer.preheader], [%j.inc, %outer.inc]
33   %j.cmp = icmp slt i32 %j, 2
34   br i1 %j.cmp, label %reduction.preheader, label %outer.exit
37     reduction.preheader:
38       br label %reduction.for
40     reduction.for:
41       %i = phi i32 [0, %reduction.preheader], [%i.inc, %reduction.inc]
42       %phi = phi double [0.0, %reduction.preheader], [%add, %reduction.inc]
43       %A_idx = getelementptr inbounds double, double* %A, i32 %j
44       %phi.cmp = fcmp ogt double %phi, 0.0
45       br i1 %phi.cmp, label %reduction.for.true, label %reduction.for.unconditional
47     reduction.for.true:
48        store double undef, double* %A_idx
49        br label %reduction.for.unconditional
51     reduction.for.unconditional:
52       %i.cmp = icmp slt i32 %i, 4
53       br i1 %i.cmp, label %body, label %reduction.exit
57         body:
58           %add = fadd double %phi, 4.2
59           br label %reduction.inc
63     reduction.inc:
64       %i.inc = add nuw nsw i32 %i, 1
65       br label %reduction.for
67     reduction.exit:
68       store double %phi, double* %A_idx
69       br label %outer.inc
73 outer.inc:
74   %j.inc = add nuw nsw i32 %j, 1
75   br label %outer.for
77 outer.exit:
78   br label %return
80 return:
81   ret void
85 ; CHECK: Statistics {
86 ; CHECK:     Compatible overwrites: 1
87 ; CHECK: }
88 ; CHECK: No modification has been made