[polly] r250411 - Do not add accesses for intra-ScopStmt scalar def-use chains

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 15 07:45:48 PDT 2015


Author: meinersbur
Date: Thu Oct 15 09:45:48 2015
New Revision: 250411

URL: http://llvm.org/viewvc/llvm-project?rev=250411&view=rev
Log:
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. 


Modified:
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-3.ll
    polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-4.ll

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=250411&r1=250410&r2=250411&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Thu Oct 15 09:45:48 2015
@@ -3228,7 +3228,8 @@ void ScopInfo::buildPHIAccesses(PHINode
       // As we pretend there is a use (or more precise a write) of OpI in OpBB
       // we have to insert a scalar dependence from the definition of OpI to
       // OpBB if the definition is not in OpBB.
-      if (OpIBB != OpBB) {
+      if (scop->getStmtForBasicBlock(OpIBB) !=
+          scop->getStmtForBasicBlock(OpBB)) {
         addScalarReadAccess(OpI, PHI, OpBB);
         addScalarWriteAccess(OpI);
       }

Modified: polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-3.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-3.ll?rev=250411&r1=250410&r2=250411&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-3.ll (original)
+++ polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-3.ll Thu Oct 15 09:45:48 2015
@@ -18,12 +18,6 @@ loop:
 ; CHECK-NEXT: %p_val1 = fadd float 1.000000e+00, 2.000000e+00
 ; CHECK-NEXT: %p_val2 = fadd float 1.000000e+00, 2.000000e+00
 ; CHECK-NEXT: store float %p_val0, float* %merge.phiops
-; CHECK-NEXT: store float %p_val1, float* %val1.s2a
-; CHECK-NEXT: store float %p_val2, float* %val2.s2a
-
-; FIXME -> The last two writes are not really needed and can be dropped if the
-;          incoming block of the PHI and the value that is used share the same
-;          non-affine region.
 
 branch1:
   br i1 %cond1, label %branch2, label %backedge

Modified: polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-4.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-4.ll?rev=250411&r1=250410&r2=250411&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-4.ll (original)
+++ polly/trunk/test/Isl/CodeGen/non-affine-phi-node-expansion-4.ll Thu Oct 15 09:45:48 2015
@@ -16,7 +16,6 @@ loop:
 ; CHECK-NEXT:    %p_val0 = fadd float 1.000000e+00, 2.000000e+00
 ; CHECK-NEXT:    %p_val1 = fadd float 1.000000e+00, 2.000000e+00
 ; CHECK-NEXT:    store float %p_val0, float* %merge.phiops
-; CHECK-NEXT:    store float %p_val1, float* %val1.s2a
 
 ; The interesting instruction here is %val2, which does not dominate the exit of
 ; the non-affine region. Care needs to be taken when code-generating this write.
@@ -29,13 +28,6 @@ branch1:
 ; CHECK-LABEL: polly.stmt.branch1:
 ; CHECK-NEXT:    %p_val2 = fadd float 1.000000e+00, 2.000000e+00
 ; CHECK-NEXT:    store float %p_val1, float* %merge.phiops
-; CHECK-NEXT:    store float %p_val2, float* %val2.s2a
-; CHECK-NEXT:    br
-
-; FIXME -> The two writes of %p_val1 and %p_val2 are not really needed and can
-;          be dropped if the incoming block of the PHI and the value that is
-;          used share the same non-affine region.
-
 
 branch2:
   br label %backedge




More information about the llvm-commits mailing list