Skip to content

Commit 668af71

Browse files
committed
Do not add accesses for intra-ScopStmt scalar def-use chains
When pulling a llvm::Value to be written as a PHI write, the former code did only check whether it is within the same basic block, but it could also be the same non-affine subregion. In that case some unecessary pair of MemoryAccesses would have been created. Two unit test were explicitely checking for the unecessary writes, including the comments that the writes are unecessary. llvm-svn: 250411
1 parent c5275bd commit 668af71

File tree

3 files changed

+2
-15
lines changed

3 files changed

+2
-15
lines changed

polly/lib/Analysis/ScopInfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3228,7 +3228,8 @@ void ScopInfo::buildPHIAccesses(PHINode *PHI, Region &R,
32283228
// As we pretend there is a use (or more precise a write) of OpI in OpBB
32293229
// we have to insert a scalar dependence from the definition of OpI to
32303230
// OpBB if the definition is not in OpBB.
3231-
if (OpIBB != OpBB) {
3231+
if (scop->getStmtForBasicBlock(OpIBB) !=
3232+
scop->getStmtForBasicBlock(OpBB)) {
32323233
addScalarReadAccess(OpI, PHI, OpBB);
32333234
addScalarWriteAccess(OpI);
32343235
}

polly/test/Isl/CodeGen/non-affine-phi-node-expansion-3.ll

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ loop:
1818
; CHECK-NEXT: %p_val1 = fadd float 1.000000e+00, 2.000000e+00
1919
; CHECK-NEXT: %p_val2 = fadd float 1.000000e+00, 2.000000e+00
2020
; CHECK-NEXT: store float %p_val0, float* %merge.phiops
21-
; CHECK-NEXT: store float %p_val1, float* %val1.s2a
22-
; CHECK-NEXT: store float %p_val2, float* %val2.s2a
23-
24-
; FIXME -> The last two writes are not really needed and can be dropped if the
25-
; incoming block of the PHI and the value that is used share the same
26-
; non-affine region.
2721

2822
branch1:
2923
br i1 %cond1, label %branch2, label %backedge

polly/test/Isl/CodeGen/non-affine-phi-node-expansion-4.ll

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ loop:
1616
; CHECK-NEXT: %p_val0 = fadd float 1.000000e+00, 2.000000e+00
1717
; CHECK-NEXT: %p_val1 = fadd float 1.000000e+00, 2.000000e+00
1818
; CHECK-NEXT: store float %p_val0, float* %merge.phiops
19-
; CHECK-NEXT: store float %p_val1, float* %val1.s2a
2019

2120
; The interesting instruction here is %val2, which does not dominate the exit of
2221
; the non-affine region. Care needs to be taken when code-generating this write.
@@ -29,13 +28,6 @@ branch1:
2928
; CHECK-LABEL: polly.stmt.branch1:
3029
; CHECK-NEXT: %p_val2 = fadd float 1.000000e+00, 2.000000e+00
3130
; CHECK-NEXT: store float %p_val1, float* %merge.phiops
32-
; CHECK-NEXT: store float %p_val2, float* %val2.s2a
33-
; CHECK-NEXT: br
34-
35-
; FIXME -> The two writes of %p_val1 and %p_val2 are not really needed and can
36-
; be dropped if the incoming block of the PHI and the value that is
37-
; used share the same non-affine region.
38-
3931

4032
branch2:
4133
br label %backedge

0 commit comments

Comments
 (0)