1; RUN: opt %loadPolly -polly-stmt-granularity=scalar-indep -polly-print-instructions -polly-scops -analyze < %s | FileCheck %s -match-full-lines 2; 3; Two PHIs, cross-referencing each other. The PHI READs must be carried-out 4; before the PHI WRITEs to ensure that the value when entering the block is 5; read. 6; This means that either both PHIs have to be in the same statement, or the 7; PHI WRITEs located in a statement after the PHIs. 8; 9; for (int j = 0; j < n; j += 1) { 10; double valA = 42.0; 11; double valB = 21.0; 12; 13; body: 14; double tmp = valA; 15; valA = valB; 16; valB = tmp; 17; A[0] = valA; 18; } 19; 20define void @func(i32 %n, double* noalias nonnull %A) { 21entry: 22 br label %for 23 24for: 25 %j = phi i32 [0, %entry], [%j.inc, %for] 26 %valA = phi double [42.0, %entry], [%valB, %for] 27 %valB = phi double [21.0, %entry], [%add, %for] 28 store double %valB, double* %A 29 %add = fadd double %valA, 0.1 30 %j.cmp = icmp slt i32 %j, %n 31 %j.inc = add nuw nsw i32 %j, 1 32 br i1 %j.cmp, label %for, label %exit 33 34exit: 35 br label %return 36 37return: 38 ret void 39} 40 41 42; CHECK: Statements { 43; CHECK-NEXT: Stmt_for 44; CHECK-NEXT: Domain := 45; CHECK-NEXT: [n] -> { Stmt_for[i0] : 0 <= i0 <= n; Stmt_for[0] : n < 0 }; 46; CHECK-NEXT: Schedule := 47; CHECK-NEXT: [n] -> { Stmt_for[i0] -> [i0] : i0 <= n; Stmt_for[0] -> [0] : n < 0 }; 48; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] 49; CHECK-NEXT: [n] -> { Stmt_for[i0] -> MemRef_valA__phi[] }; 50; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1] 51; CHECK-NEXT: [n] -> { Stmt_for[i0] -> MemRef_valA__phi[] }; 52; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] 53; CHECK-NEXT: [n] -> { Stmt_for[i0] -> MemRef_valB__phi[] }; 54; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1] 55; CHECK-NEXT: [n] -> { Stmt_for[i0] -> MemRef_valB__phi[] }; 56; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] 57; CHECK-NEXT: [n] -> { Stmt_for[i0] -> MemRef_A[0] }; 58; CHECK-NEXT: Instructions { 59; CHECK-NEXT: %valA = phi double [ 4.200000e+01, %entry ], [ %valB, %for ] 60; CHECK-NEXT: %valB = phi double [ 2.100000e+01, %entry ], [ %add, %for ] 61; CHECK-NEXT: store double %valB, double* %A, align 8 62; CHECK-NEXT: %add = fadd double %valA, 1.000000e-01 63; CHECK-NEXT: } 64; CHECK-NEXT: } 65