Clang] Fix expansion of response files in -Wp after integrated-cc1 change
[llvm-project.git] / polly / test / MaximalStaticExpansion / working_phi_expansion.ll
blob2cbf3452e434ecb740dcf57657a1676f22a5ed20
1 ; RUN: opt %loadPolly -polly-mse -analyze < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-mse -pass-remarks-analysis="polly-mse" -analyze < %s 2>&1 | FileCheck %s --check-prefix=MSE
4 ; Verify that the accesses are correctly expanded for MemoryKind::PHI
5 ; tmp_04 is not expanded because it need copy-in.
7 ; Original source code :
9 ; #define Ni 10000
10 ; #define Nj 10000
12 ; void mse(double A[Ni], double B[Nj]) {
13 ;   int i,j;
14 ;   double tmp = 6;
15 ;   for (i = 0; i < Ni; i++) {
16 ;     for (int j = 0; j<Nj; j++) {
17 ;       tmp = tmp + 2;
18 ;     }
19 ;     B[i] = tmp;
20 ;   }
22 ; Check that the pass detects that tmp_04 reads from original value.
24 ; MSE: MemRef_tmp_04__phi read from its original value.
26 ; Check that the SAI are created except the expanded SAI of tmp_04.
28 ; CHECK-NOT: double MemRef_tmp_04__phi_Stmt_for_body_expanded[10000]; // Element size 8
29 ; CHECK: double MemRef_tmp_11__phi_Stmt_for_inc_expanded[10000][10000]; // Element size
30 ; CHECK: double MemRef_add_lcssa__phi_Stmt_for_end_expanded[10000]; // Element size 8
31 ; CHECK: double MemRef_B_Stmt_for_end_expanded[10000]; // Element size 8
33 ; Check that the memory accesses are modified except those related to tmp_04.
35 ; CHECK-NOT: new: { Stmt_for_body[i0] -> MemRef_tmp_04__phi_Stmt_for_body_expanded[i0] };
36 ; CHECK: new: { Stmt_for_body[i0] -> MemRef_tmp_11__phi_Stmt_for_inc_expanded[i0, 0] };
37 ; CHECK: new: { Stmt_for_inc[i0, i1] -> MemRef_tmp_11__phi_Stmt_for_inc_expanded[i0, 1 + i1] : i1 <= 9998 };
38 ; CHECK: new: { Stmt_for_inc[i0, i1] -> MemRef_tmp_11__phi_Stmt_for_inc_expanded[i0, i1] };
39 ; CHECK: new: { Stmt_for_inc[i0, 9999] -> MemRef_add_lcssa__phi_Stmt_for_end_expanded[i0] };
40 ; CHECK-NOT: new: { Stmt_for_end[i0] -> MemRef_tmp_04__phi_Stmt_for_body_expanded[1 + i0] : i0 <= 9998 };
41 ; CHECK: new: { Stmt_for_end[i0] -> MemRef_add_lcssa__phi_Stmt_for_end_expanded[i0] };
42 ; CHECK: new: { Stmt_for_end[i0] -> MemRef_B_Stmt_for_end_expanded[i0] };
44 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
45 target triple = "x86_64-unknown-linux-gnu"
47 define void @tmp(double* %A, double* %B) {
48 entry:
49   br label %entry.split
51 entry.split:                                      ; preds = %entry
52   br label %for.body
54 for.body:                                         ; preds = %entry.split, %for.end
55   %indvars.iv = phi i64 [ 0, %entry.split ], [ %indvars.iv.next, %for.end ]
56   %tmp.04 = phi double [ 6.000000e+00, %entry.split ], [ %add.lcssa, %for.end ]
57   br label %for.inc
59 for.inc:                                          ; preds = %for.body, %for.inc
60   %j1.02 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
61   %tmp.11 = phi double [ %tmp.04, %for.body ], [ %add, %for.inc ]
62   %add = fadd double %tmp.11, 2.000000e+00
63   %inc = add nuw nsw i32 %j1.02, 1
64   %exitcond = icmp ne i32 %inc, 10000
65   br i1 %exitcond, label %for.inc, label %for.end
67 for.end:                                          ; preds = %for.inc
68   %add.lcssa = phi double [ %add, %for.inc ]
69   %arrayidx = getelementptr inbounds double, double* %B, i64 %indvars.iv
70   store double %add.lcssa, double* %arrayidx, align 8
71   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
72   %exitcond5 = icmp ne i64 %indvars.iv.next, 10000
73   br i1 %exitcond5, label %for.body, label %for.end7
75 for.end7:                                         ; preds = %for.end
76   ret void