[Github] Label lldb-dap PRs (#125139)
[llvm-project.git] / polly / test / DeLICM / nomap_alreadymapped.ll
blobda5f4ec24a47e37ec04db8bc5d148730d8e9a5df
1 ; RUN: opt %loadNPMPolly '-passes=print<polly-delicm>' -disable-output < %s | FileCheck %s
3 ;    void func(double *A) {
4 ;      for (int j = 0; j < 2; j += 1) { /* outer */
5 ;        double phi1 = 0.0, phi2 = 0.0;
6 ;        for (int i = 0; i < 4; i += 1) { /* reduction */
7 ;          phi1 += 4.2;
8 ;          phi2 += 29.0;
9 ;        }
10 ;        A[j] = phi1 + phi2;
11 ;      }
12 ;    }
14 ; Check that we cannot map both, %phi1 and %phi2 to A[j] (conflict).
15 ; Note that it is undefined which one will be mapped. We keep the test
16 ; symmetric so it passes if either one is mapped.
18 define void @func(ptr 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   br i1 %j.cmp, label %reduction.preheader, label %outer.exit
31     reduction.preheader:
32       br label %reduction.for
34     reduction.for:
35       %i = phi i32 [0, %reduction.preheader], [%i.inc, %reduction.inc]
36       %phi1 = phi double [0.0, %reduction.preheader], [%add1, %reduction.inc]
37       %phi2 = phi double [0.0, %reduction.preheader], [%add2, %reduction.inc]
38       %i.cmp = icmp slt i32 %i, 4
39       br i1 %i.cmp, label %body, label %reduction.exit
43         body:
44           %add1 = fadd double %phi1, 4.2
45           %add2 = fadd double %phi2, 29.0
46           br label %reduction.inc
50     reduction.inc:
51       %i.inc = add nuw nsw i32 %i, 1
52       br label %reduction.for
54     reduction.exit:
55       %A_idx = getelementptr inbounds double, ptr %A, i32 %j
56       %sum = fadd double %phi1, %phi2
57       store double %sum, ptr %A_idx
58       br label %outer.inc
62 outer.inc:
63   %j.inc = add nuw nsw i32 %j, 1
64   br label %outer.for
66 outer.exit:
67   br label %return
69 return:
70   ret void
74 ; CHECK: Statistics {
75 ; CHECK:     Compatible overwrites: 1
76 ; CHECK:     Overwrites mapped to:  1
77 ; CHECK:     Value scalars mapped:  2
78 ; CHECK:     PHI scalars mapped:    1
79 ; CHECK: }