[DeLICM] Add nomap regressions tests. NFC.
[polly-mirror.git] / test / DeLICM / nomap_readonly.ll
blob323963251027635cb36a561b2ba9c704becc7fd9
1 ; RUN: opt %loadPolly -polly-delicm -analyze < %s | FileCheck %s
3 ;    void func(double *A) {
4 ;      fsomeval = 21.0 + 21.0;
5 ;      for (int j = 0; j < 2; j += 1) { /* outer */
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 ;    }
13 ; Check that fsomeval is not mapped to A[j] because it is read-only.
14 ; There is no advantage in mapping values not modified within the SCoP.
16 define void @func(double* noalias nonnull %A) {
17 entry:
18   %fsomeval = fadd double 21.0, 21.0
19   br label %outer.preheader
21 outer.preheader:
22   br label %outer.for
24 outer.for:
25   %j = phi i32 [0, %outer.preheader], [%j.inc, %outer.inc]
26   %j.cmp = icmp slt i32 %j, 2
27   br i1 %j.cmp, label %reduction.preheader, label %outer.exit
30     reduction.preheader:
31       br label %reduction.for
33     reduction.for:
34       %i = phi i32 [0, %reduction.preheader], [%i.inc, %reduction.inc]
35       %phi = phi double [0.0, %reduction.preheader], [%add, %reduction.inc]
36       %i.cmp = icmp slt i32 %i, 4
37       br i1 %i.cmp, label %body, label %reduction.exit
41         body:
42           %add = fadd double %phi, 4.2
43           br label %reduction.inc
47     reduction.inc:
48       %i.inc = add nuw nsw i32 %i, 1
49       br label %reduction.for
51     reduction.exit:
52       %A_idx = getelementptr inbounds double, double* %A, i32 %j
53       store double %fsomeval, double* %A_idx
54       br label %outer.inc
58 outer.inc:
59   %j.inc = add nuw nsw i32 %j, 1
60   br label %outer.for
62 outer.exit:
63   br label %return
65 return:
66   ret void
70 ; CHECK: Statistics {
71 ; CHECK:     Compatible overwrites: 1
72 ; CHECK: }
73 ; CHECK: No modification has been made