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], [%valA, %for] 28 store double %valA, double* %A 29 %j.cmp = icmp slt i32 %j, %n 30 %j.inc = add nuw nsw i32 %j, 1 31 br i1 %j.cmp, label %for, label %exit 32 33exit: 34 br label %return 35 36return: 37 ret void 38} 39 40 41; CHECK: Statements { 42; CHECK-NEXT: Stmt_for 43; CHECK-NEXT: Domain := 44; CHECK-NEXT: [n] -> { Stmt_for[i0] : 0 <= i0 <= n; Stmt_for[0] : n < 0 }; 45; CHECK-NEXT: Schedule := 46; CHECK-NEXT: [n] -> { Stmt_for[i0] -> [i0] : i0 <= n; Stmt_for[0] -> [0] : n < 0 }; 47; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] 48; CHECK-NEXT: [n] -> { Stmt_for[i0] -> MemRef_valA__phi[] }; 49; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1] 50; CHECK-NEXT: [n] -> { Stmt_for[i0] -> MemRef_valA__phi[] }; 51; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] 52; CHECK-NEXT: [n] -> { Stmt_for[i0] -> MemRef_valB__phi[] }; 53; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1] 54; CHECK-NEXT: [n] -> { Stmt_for[i0] -> MemRef_valB__phi[] }; 55; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] 56; CHECK-NEXT: [n] -> { Stmt_for[i0] -> MemRef_A[0] }; 57; CHECK-NEXT: Instructions { 58; CHECK-NEXT: %valA = phi double [ 4.200000e+01, %entry ], [ %valB, %for ] 59; CHECK-NEXT: %valB = phi double [ 2.100000e+01, %entry ], [ %valA, %for ] 60; CHECK-NEXT: store double %valA, double* %A, align 8 61; CHECK-NEXT: } 62; CHECK-NEXT: } 63