[polly] r246429 - Also build scalar dependences for store instructions

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 04:15:00 PDT 2015


Author: grosser
Date: Mon Aug 31 06:15:00 2015
New Revision: 246429

URL: http://llvm.org/viewvc/llvm-project?rev=246429&view=rev
Log:
Also build scalar dependences for store instructions

While ignoring read-only scalar dependences it was not necessary to consider
store instructins, but as store instructions can be the target of a scalar
read-only dependency we need to consider them for the construction of scalar
read-only dependences.

Modified:
    polly/trunk/lib/Analysis/TempScopInfo.cpp
    polly/trunk/test/ScopInfo/read-only-scalars.ll

Modified: polly/trunk/lib/Analysis/TempScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/TempScopInfo.cpp?rev=246429&r1=246428&r2=246429&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/TempScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/TempScopInfo.cpp Mon Aug 31 06:15:00 2015
@@ -317,13 +317,14 @@ void TempScopInfo::buildAccessFunctions(
     if (PHINode *PHI = dyn_cast<PHINode>(Inst))
       buildPHIAccesses(PHI, R, Functions, NonAffineSubRegion);
 
-    if (!isa<StoreInst>(Inst) &&
-        buildScalarDependences(Inst, &R, NonAffineSubRegion)) {
+    if (buildScalarDependences(Inst, &R, NonAffineSubRegion)) {
       // If the Instruction is used outside the statement, we need to build the
       // write access.
-      IRAccess ScalarAccess(IRAccess::MUST_WRITE, Inst, ZeroOffset, 1, true,
-                            Inst);
-      Functions.push_back(std::make_pair(ScalarAccess, Inst));
+      if (!isa<StoreInst>(Inst)) {
+        IRAccess ScalarAccess(IRAccess::MUST_WRITE, Inst, ZeroOffset, 1, true,
+                              Inst);
+        Functions.push_back(std::make_pair(ScalarAccess, Inst));
+      }
     }
   }
 

Modified: polly/trunk/test/ScopInfo/read-only-scalars.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/read-only-scalars.ll?rev=246429&r1=246428&r2=246429&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/read-only-scalars.ll (original)
+++ polly/trunk/test/ScopInfo/read-only-scalars.ll Mon Aug 31 06:15:00 2015
@@ -10,8 +10,11 @@
 
 ; SCALARS: ReadAccess :=  [Reduction Type: NONE] [Scalar: 1]
 ; SCALARS:     { Stmt_stmt1[i0] -> MemRef_scalar[] };
+; SCALARS: ReadAccess :=       [Reduction Type: NONE] [Scalar: 1]
+; SCALARS:     { Stmt_stmt1[i0] -> MemRef_scalar2[] };
 
-define void @foo(float* noalias %A, float %scalar) {
+
+define void @foo(float* noalias %A, float* %B, float %scalar, float %scalar2) {
 entry:
   br label %loop
 
@@ -23,6 +26,7 @@ stmt1:
   %val = load float, float* %A
   %sum = fadd float %val, %scalar
   store float %sum, float* %A
+  store float %scalar2, float* %B
   br label %loop.backedge
 
 loop.backedge:




More information about the llvm-commits mailing list