[DeLICM] Add nomap regressions tests. NFC.
[polly-mirror.git] / test / DeLICM / nomap_escaping.ll
blob1a5fc8072e39e552d8761418ba4335d7b895645b
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 ;        fsomeval = 21.0 + 21.0;
6 ;        double phi = 0.0;
7 ;        for (int i = 0; i < 4; i += 1) /* reduction */
8 ;          phi += 4.2;
9 ;        A[j] = fsomeval;
10 ;      }
11 ;      g(fsomeval);
12 ;    }
14 ; Check that fsomeval is not mapped to A[j] because it is escaping the SCoP.
15 ; Supporting this would require reloading the scalar from A[j], and/or
16 ; identifying the last instance of fsomeval that escapes.
18 define void @func(double* noalias nonnull %A) {
19 entry:
20   br label %outer.preheader
22 outer.preheader:
23   br label %outer.for
25 outer.for:
26   %j = phi i32 [0, %outer.preheader], [%j.inc, %outer.inc]
27   %j.cmp = icmp slt i32 %j, 2
28   %fsomeval = fadd double 21.0, 21.0
29   br i1 %j.cmp, label %reduction.preheader, label %outer.exit
32     reduction.preheader:
33       br label %reduction.for
35     reduction.for:
36       %i = phi i32 [0, %reduction.preheader], [%i.inc, %reduction.inc]
37       %phi = phi double [0.0, %reduction.preheader], [%add, %reduction.inc]
38       %i.cmp = icmp slt i32 %i, 4
39       br i1 %i.cmp, label %body, label %reduction.exit
43         body:
44           %add = fadd double %phi, 4.2
45           br label %reduction.inc
49     reduction.inc:
50       %i.inc = add nuw nsw i32 %i, 1
51       br label %reduction.for
53     reduction.exit:
54       %A_idx = getelementptr inbounds double, double* %A, i32 %j
55       store double %fsomeval, double* %A_idx
56       br label %outer.inc
60 outer.inc:
61   %j.inc = add nuw nsw i32 %j, 1
62   br label %outer.for
64 outer.exit:
65   br label %return
67 return:
68   call void @g(double %fsomeval)
69   ret void
72 declare void @g(double)
75 ; CHECK: Statistics {
76 ; CHECK:     Compatible overwrites: 1
77 ; CHECK: }
78 ; CHECK: No modification has been made