[polly] r258998 - ScopInfo: Never add read accesses for synthesizable values
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 27 14:51:56 PST 2016
Author: meinersbur
Date: Wed Jan 27 16:51:56 2016
New Revision: 258998
URL: http://llvm.org/viewvc/llvm-project?rev=258998&view=rev
Log:
ScopInfo: Never add read accesses for synthesizable values
Before adding a MK_Value READ MemoryAccess, check whether the read is
necessary or synthesizable. Synthesizable values are later generated by
the SCEVExpander and therefore do not need to be transferred
explicitly. This can happen because the check for synthesizability has
presumbly been forgotten in the case where a phi's incoming value has
been defined in a different statement.
Differential Revision: http://reviews.llvm.org/D15687
Modified:
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/test/Isl/CodeGen/phi-defined-before-scop.ll
polly/trunk/test/Isl/CodeGen/synthesizable_phi_write_after_loop.ll
polly/trunk/test/Isl/CodeGen/uninitialized_scalar_memory.ll
polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll
polly/trunk/test/ScopInfo/non_affine_region_1.ll
polly/trunk/test/ScopInfo/non_affine_region_3.ll
polly/trunk/test/ScopInfo/pointer-used-as-base-pointer-and-scalar-read.ll
polly/trunk/test/ScopInfo/same-base-address-scalar-and-array.ll
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=258998&r1=258997&r2=258998&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Wed Jan 27 16:51:56 2016
@@ -3962,6 +3962,13 @@ void ScopInfo::ensureValueWrite(Instruct
ArrayRef<const SCEV *>(), ScopArrayInfo::MK_Value);
}
void ScopInfo::ensureValueRead(Value *Value, BasicBlock *UserBB) {
+
+ // If the instruction can be synthesized and the user is in the region we do
+ // not need to add a value dependences.
+ Region &ScopRegion = scop->getRegion();
+ if (canSynthesize(Value, LI, SE, &ScopRegion))
+ return;
+
ScopStmt *UserStmt = scop->getStmtForBasicBlock(UserBB);
// We do not model uses outside the scop.
Modified: polly/trunk/test/Isl/CodeGen/phi-defined-before-scop.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/phi-defined-before-scop.ll?rev=258998&r1=258997&r2=258998&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/phi-defined-before-scop.ll (original)
+++ polly/trunk/test/Isl/CodeGen/phi-defined-before-scop.ll Wed Jan 27 16:51:56 2016
@@ -4,8 +4,7 @@
; CHECK-NEXT: %tmp7.ph.merge = phi %struct.wibble* [ %tmp7.ph.final_reload, %polly.exiting ], [ %tmp7.ph, %bb6.region_exiting ]
; CHECK-LABEL: polly.stmt.bb3:
-; CHECK-NEXT: %tmp2.s2a.reload = load %struct.wibble*, %struct.wibble** %tmp2.s2a
-; CHECK-NEXT: store %struct.wibble* %tmp2.s2a.reload, %struct.wibble** %tmp7.s2a
+; CHECK-NEXT: store %struct.wibble* %tmp2, %struct.wibble** %tmp7.s2a
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
Modified: polly/trunk/test/Isl/CodeGen/synthesizable_phi_write_after_loop.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/synthesizable_phi_write_after_loop.ll?rev=258998&r1=258997&r2=258998&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/synthesizable_phi_write_after_loop.ll (original)
+++ polly/trunk/test/Isl/CodeGen/synthesizable_phi_write_after_loop.ll Wed Jan 27 16:51:56 2016
@@ -8,17 +8,11 @@
; In this case the Loop passed to the expander must NOT be the loop
; - Overwriting the same alloca in each iteration s.t. the last value will
; retain in %i.inc.s2a
-; The latter is currently generated by Polly and tested here.
+; The first is currently generated by Polly and tested here.
; CHECK: polly.stmt.next:
-; CHECK-NEXT: %i.inc.s2a.reload = load i32, i32* %i.inc.s2a
-; CHECK-NEXT: store i32 %i.inc.s2a.reload, i32* %phi.phiops
+; CHECK-NEXT: store i32 2, i32* %phi.phiops
; CHECK-NEXT: br label %polly.stmt.join
-;
-; CHECK: polly.stmt.loop:
-; CHECK: %0 = trunc i64 %polly.indvar to i32
-; CHECK: %1 = add i32 %0, 1
-; CHECK: store i32 %1, i32* %i.inc.s2a
define i32 @func() {
entry:
Modified: polly/trunk/test/Isl/CodeGen/uninitialized_scalar_memory.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/uninitialized_scalar_memory.ll?rev=258998&r1=258997&r2=258998&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/uninitialized_scalar_memory.ll (original)
+++ polly/trunk/test/Isl/CodeGen/uninitialized_scalar_memory.ll Wed Jan 27 16:51:56 2016
@@ -5,7 +5,6 @@
;
; CHECK: polly.start:
; CHECK-NEXT: store float %ebig.0, float* %ebig.0.s2a
-; CHECK-NEXT: store i32 %iebig.0, i32* %iebig.0.s2a
; CHECK-NEXT: br label %polly.stmt.if.end.entry
;
; int g(void);
Modified: polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll?rev=258998&r1=258997&r2=258998&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll (original)
+++ polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll Wed Jan 27 16:51:56 2016
@@ -25,7 +25,6 @@
; CHECK-NEXT: i32 MemRef_j_0__phi; // Element size 4
; CHECK-NEXT: i32 MemRef_j_0; // Element size 4
; CHECK-NEXT: i32 MemRef_A[*]; // Element size 4
-; CHECK-NEXT: i32 MemRef_smax; // Element size 4
; CHECK-NEXT: i32 MemRef_j_2__phi; // Element size 4
; CHECK-NEXT: i32 MemRef_j_2; // Element size 4
; CHECK-NEXT: }
@@ -33,7 +32,6 @@
; CHECK-NEXT: i32 MemRef_j_0__phi; // Element size 4
; CHECK-NEXT: i32 MemRef_j_0; // Element size 4
; CHECK-NEXT: i32 MemRef_A[*]; // Element size 4
-; CHECK-NEXT: i32 MemRef_smax; // Element size 4
; CHECK-NEXT: i32 MemRef_j_2__phi; // Element size 4
; CHECK-NEXT: i32 MemRef_j_2; // Element size 4
; CHECK-NEXT: }
@@ -60,8 +58,6 @@
; CHECK-NEXT: [N] -> { Stmt_bb4__TO__bb18[i0] -> MemRef_A[i0] };
; CHECK-NEXT: MayWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: [N] -> { Stmt_bb4__TO__bb18[i0] -> MemRef_A[i0] };
-; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
-; CHECK-NEXT: [N] -> { Stmt_bb4__TO__bb18[i0] -> MemRef_smax[] };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
; CHECK-NEXT: [N] -> { Stmt_bb4__TO__bb18[i0] -> MemRef_j_2__phi[] };
; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
Modified: polly/trunk/test/ScopInfo/non_affine_region_1.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/non_affine_region_1.ll?rev=258998&r1=258997&r2=258998&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/non_affine_region_1.ll (original)
+++ polly/trunk/test/ScopInfo/non_affine_region_1.ll Wed Jan 27 16:51:56 2016
@@ -41,8 +41,6 @@
; CHECK-NEXT: [b] -> { Stmt_bb8[0] : b = 0 };
; CHECK-NEXT: Schedule :=
; CHECK-NEXT: [b] -> { Stmt_bb8[i0] -> [0, 0] };
-; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
-; CHECK-NEXT: [b] -> { Stmt_bb8[i0] -> MemRef_b[] };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
; CHECK-NEXT: [b] -> { Stmt_bb8[i0] -> MemRef_x_1__phi[] };
; CHECK-NEXT: Stmt_bb10__TO__bb18
Modified: polly/trunk/test/ScopInfo/non_affine_region_3.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/non_affine_region_3.ll?rev=258998&r1=258997&r2=258998&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/non_affine_region_3.ll (original)
+++ polly/trunk/test/ScopInfo/non_affine_region_3.ll Wed Jan 27 16:51:56 2016
@@ -31,8 +31,6 @@
; CHECK-NEXT: { Stmt_bb3__TO__bb18[i0] -> MemRef_A[i0] };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
; CHECK-NEXT: { Stmt_bb3__TO__bb18[i0] -> MemRef_x_2__phi[] };
-; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
-; CHECK-NEXT: { Stmt_bb3__TO__bb18[i0] -> MemRef_b[] };
; CHECK-NEXT: Stmt_bb18
; CHECK-NEXT: Domain :=
; CHECK-NEXT: { Stmt_bb18[i0] : 0 <= i0 <= 1023 };
Modified: polly/trunk/test/ScopInfo/pointer-used-as-base-pointer-and-scalar-read.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/pointer-used-as-base-pointer-and-scalar-read.ll?rev=258998&r1=258997&r2=258998&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/pointer-used-as-base-pointer-and-scalar-read.ll (original)
+++ polly/trunk/test/ScopInfo/pointer-used-as-base-pointer-and-scalar-read.ll Wed Jan 27 16:51:56 2016
@@ -6,16 +6,12 @@
; CHECK: Arrays {
; CHECK-NEXT: float MemRef_A[*]; // Element size 4
-; CHECK-NEXT: float* MemRef_A; // Element size 8
; CHECK-NEXT: float* MemRef_x__phi; // Element size 8
-; CHECK-NEXT: float* MemRef_B; // Element size 8
; CHECK-NEXT: float* MemRef_C[*]; // Element size 8
; CHECK-NEXT: }
; CHECK: Arrays (Bounds as pw_affs) {
; CHECK-NEXT: float MemRef_A[*]; // Element size 4
-; CHECK-NEXT: float* MemRef_A; // Element size 8
; CHECK-NEXT: float* MemRef_x__phi; // Element size 8
-; CHECK-NEXT: float* MemRef_B; // Element size 8
; CHECK-NEXT: float* MemRef_C[*]; // Element size 8
; CHECK-NEXT: }
; CHECK: Alias Groups (0):
@@ -28,8 +24,6 @@
; CHECK-NEXT: [p] -> { Stmt_then[i0] -> [i0, 1] };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: [p] -> { Stmt_then[i0] -> MemRef_A[0] };
-; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
-; CHECK-NEXT: [p] -> { Stmt_then[i0] -> MemRef_A[] };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
; CHECK-NEXT: [p] -> { Stmt_then[i0] -> MemRef_x__phi[] };
; CHECK-NEXT: Stmt_else
@@ -39,8 +33,6 @@
; CHECK-NEXT: [p] -> { Stmt_else[i0] -> [i0, 0] : p >= 33 or p <= 31 };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
; CHECK-NEXT: [p] -> { Stmt_else[i0] -> MemRef_A[0] };
-; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
-; CHECK-NEXT: [p] -> { Stmt_else[i0] -> MemRef_B[] };
; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
; CHECK-NEXT: [p] -> { Stmt_else[i0] -> MemRef_x__phi[] };
; CHECK-NEXT: Stmt_bb8
Modified: polly/trunk/test/ScopInfo/same-base-address-scalar-and-array.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/same-base-address-scalar-and-array.ll?rev=258998&r1=258997&r2=258998&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/same-base-address-scalar-and-array.ll (original)
+++ polly/trunk/test/ScopInfo/same-base-address-scalar-and-array.ll Wed Jan 27 16:51:56 2016
@@ -4,7 +4,6 @@
; as it is used as a memory base pointer (%0) but also as a scalar (%out.addr.0.lcssa).
;
; CHECK: Arrays {
-; CHECK-NEXT: float* MemRef_out; // Element size 8
; CHECK-NEXT: float* MemRef_out_addr_0_lcssa; // Element size 8
; CHECK-NEXT: float MemRef_out[*]; // Element size 4
; CHECK-NEXT: }
More information about the llvm-commits
mailing list