[polly] r270428 - Simplify ScopInfo function interfaces [NFC]

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Mon May 23 05:45:17 PDT 2016


Author: jdoerfert
Date: Mon May 23 07:45:17 2016
New Revision: 270428

URL: http://llvm.org/viewvc/llvm-project?rev=270428&view=rev
Log:
Simplify ScopInfo function interfaces [NFC]

Modified:
    polly/trunk/include/polly/ScopInfo.h
    polly/trunk/lib/Analysis/ScopInfo.cpp

Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=270428&r1=270427&r2=270428&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Mon May 23 07:45:17 2016
@@ -2292,53 +2292,47 @@ class ScopInfo : public RegionPass {
   ///
   /// @param Inst       The Load/Store instruction that access the memory
   /// @param L          The parent loop of the instruction
-  /// @param R          The region on which to build the data access dictionary.
   ///
   /// @returns True if the access could be built, False otherwise.
-  bool buildAccessMultiDimFixed(MemAccInst Inst, Loop *L, Region *R);
+  bool buildAccessMultiDimFixed(MemAccInst Inst, Loop *L);
 
   /// @brief Try to build a multi-dimensional parameteric sized MemoryAccess
   ///        from the Load/Store instruction.
   ///
   /// @param Inst       The Load/Store instruction that access the memory
   /// @param L          The parent loop of the instruction
-  /// @param R          The region on which to build the data access dictionary.
   ///
   /// @returns True if the access could be built, False otherwise.
-  bool buildAccessMultiDimParam(MemAccInst Inst, Loop *L, Region *R);
+  bool buildAccessMultiDimParam(MemAccInst Inst, Loop *L);
 
   /// @brief Try to build a MemoryAccess for a memory intrinsic.
   ///
   /// @param Inst       The instruction that access the memory
   /// @param L          The parent loop of the instruction
-  /// @param R          The region on which to build the data access dictionary.
   ///
   /// @returns True if the access could be built, False otherwise.
-  bool buildAccessMemIntrinsic(MemAccInst Inst, Loop *L, Region *R);
+  bool buildAccessMemIntrinsic(MemAccInst Inst, Loop *L);
 
   /// @brief Try to build a MemoryAccess for a call instruction.
   ///
   /// @param Inst       The call instruction that access the memory
   /// @param L          The parent loop of the instruction
-  /// @param R          The region on which to build the data access dictionary.
   ///
   /// @returns True if the access could be built, False otherwise.
-  bool buildAccessCallInst(MemAccInst Inst, Loop *L, Region *R);
+  bool buildAccessCallInst(MemAccInst Inst, Loop *L);
 
   /// @brief Build a single-dimensional parameteric sized MemoryAccess
   ///        from the Load/Store instruction.
   ///
   /// @param Inst       The Load/Store instruction that access the memory
   /// @param L          The parent loop of the instruction
-  /// @param R          The region on which to build the data access dictionary.
-  void buildAccessSingleDim(MemAccInst Inst, Loop *L, Region *R);
+  void buildAccessSingleDim(MemAccInst Inst, Loop *L);
 
   /// @brief Build an instance of MemoryAccess from the Load/Store instruction.
   ///
   /// @param Inst       The Load/Store instruction that access the memory
   /// @param L          The parent loop of the instruction
-  /// @param R          The region on which to build the data access dictionary.
-  void buildMemoryAccess(MemAccInst Inst, Loop *L, Region *R);
+  void buildMemoryAccess(MemAccInst Inst, Loop *L);
 
   /// @brief Analyze and extract the cross-BB scalar dependences (or,
   ///        dataflow dependencies) of an instruction.
@@ -2356,35 +2350,31 @@ class ScopInfo : public RegionPass {
   /// @brief Create MemoryAccesses for the given PHI node in the given region.
   ///
   /// @param PHI                The PHI node to be handled
-  /// @param R                  The SCoP region
   /// @param NonAffineSubRegion The non affine sub-region @p PHI is in.
   /// @param IsExitBlock        Flag to indicate that @p PHI is in the exit BB.
-  void buildPHIAccesses(PHINode *PHI, Region &R, Region *NonAffineSubRegion,
+  void buildPHIAccesses(PHINode *PHI, Region *NonAffineSubRegion,
                         bool IsExitBlock = false);
 
   /// @brief Build the access functions for the subregion @p SR.
   ///
-  /// @param R            The SCoP region.
   /// @param SR           A subregion of @p R.
   /// @param InsnToMemAcc The Instruction to MemoryAccess mapping.
-  void buildAccessFunctions(Region &R, Region &SR);
+  void buildAccessFunctions(Region &SR);
 
   /// @brief Create ScopStmt for all BBs and non-affine subregions of @p SR.
   ///
-  /// @param R  The SCoP region.
   /// @param SR A subregion of @p R.
   ///
   /// Some of the statments might be optimized away later when they do not
   /// access any memory and thus have no effect.
-  void buildStmts(Region &R, Region &SR);
+  void buildStmts(Region &SR);
 
   /// @brief Build the access functions for the basic block @p BB
   ///
-  /// @param R                  The SCoP region.
   /// @param BB                 A basic block in @p R.
   /// @param NonAffineSubRegion The non affine sub-region @p BB is in.
   /// @param IsExitBlock        Flag to indicate that @p BB is in the exit BB.
-  void buildAccessFunctions(Region &R, BasicBlock &BB,
+  void buildAccessFunctions(BasicBlock &BB,
                             Region *NonAffineSubRegion = nullptr,
                             bool IsExitBlock = false);
 

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=270428&r1=270427&r2=270428&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Mon May 23 07:45:17 2016
@@ -4243,8 +4243,8 @@ int Scop::getRelativeLoopDepth(const Loo
   return L->getLoopDepth() - OuterLoop->getLoopDepth();
 }
 
-void ScopInfo::buildPHIAccesses(PHINode *PHI, Region &R,
-                                Region *NonAffineSubRegion, bool IsExitBlock) {
+void ScopInfo::buildPHIAccesses(PHINode *PHI, Region *NonAffineSubRegion,
+                                bool IsExitBlock) {
 
   // PHI nodes that are in the exit block of the region, hence if IsExitBlock is
   // true, are not modeled as ordinary PHI nodes as they are not part of the
@@ -4255,7 +4255,7 @@ void ScopInfo::buildPHIAccesses(PHINode
   // the region. If it is not it can only be in the exit block of the region.
   // In this case we model the operands but not the PHI itself.
   auto *Scope = LI->getLoopFor(PHI->getParent());
-  if (!IsExitBlock && canSynthesize(PHI, LI, SE, &R, Scope))
+  if (!IsExitBlock && canSynthesize(PHI, LI, SE, &scop->getRegion(), Scope))
     return;
 
   // PHI nodes are modeled as if they had been demoted prior to the SCoP
@@ -4314,7 +4314,7 @@ void ScopInfo::buildEscapingDependences(
   }
 }
 
-bool ScopInfo::buildAccessMultiDimFixed(MemAccInst Inst, Loop *L, Region *R) {
+bool ScopInfo::buildAccessMultiDimFixed(MemAccInst Inst, Loop *L) {
   Value *Val = Inst.getValueOperand();
   Type *ElementType = Val->getType();
   Value *Address = Inst.getPointerOperand();
@@ -4361,7 +4361,7 @@ bool ScopInfo::buildAccessMultiDimFixed(
   const InvariantLoadsSetTy &ScopRIL = scop->getRequiredInvariantLoads();
   for (auto *Subscript : Subscripts) {
     InvariantLoadsSetTy AccessILS;
-    if (!isAffineExpr(R, L, Subscript, *SE, &AccessILS))
+    if (!isAffineExpr(&scop->getRegion(), L, Subscript, *SE, &AccessILS))
       return false;
 
     for (LoadInst *LInst : AccessILS)
@@ -4381,7 +4381,7 @@ bool ScopInfo::buildAccessMultiDimFixed(
   return true;
 }
 
-bool ScopInfo::buildAccessMultiDimParam(MemAccInst Inst, Loop *L, Region *R) {
+bool ScopInfo::buildAccessMultiDimParam(MemAccInst Inst, Loop *L) {
   if (!PollyDelinearize)
     return false;
 
@@ -4424,7 +4424,7 @@ bool ScopInfo::buildAccessMultiDimParam(
   return true;
 }
 
-bool ScopInfo::buildAccessMemIntrinsic(MemAccInst Inst, Loop *L, Region *R) {
+bool ScopInfo::buildAccessMemIntrinsic(MemAccInst Inst, Loop *L) {
   auto *MemIntr = dyn_cast_or_null<MemIntrinsic>(Inst);
 
   if (MemIntr == nullptr)
@@ -4436,7 +4436,8 @@ bool ScopInfo::buildAccessMemIntrinsic(M
   // Check if the length val is actually affine or if we overapproximate it
   InvariantLoadsSetTy AccessILS;
   const InvariantLoadsSetTy &ScopRIL = scop->getRequiredInvariantLoads();
-  bool LengthIsAffine = isAffineExpr(R, L, LengthVal, *SE, &AccessILS);
+  bool LengthIsAffine =
+      isAffineExpr(&scop->getRegion(), L, LengthVal, *SE, &AccessILS);
   for (LoadInst *LInst : AccessILS)
     if (!ScopRIL.count(LInst))
       LengthIsAffine = false;
@@ -4487,7 +4488,7 @@ bool ScopInfo::buildAccessMemIntrinsic(M
   return true;
 }
 
-bool ScopInfo::buildAccessCallInst(MemAccInst Inst, Loop *L, Region *R) {
+bool ScopInfo::buildAccessCallInst(MemAccInst Inst, Loop *L) {
   auto *CI = dyn_cast_or_null<CallInst>(Inst);
 
   if (CI == nullptr)
@@ -4530,7 +4531,7 @@ bool ScopInfo::buildAccessCallInst(MemAc
   return true;
 }
 
-void ScopInfo::buildAccessSingleDim(MemAccInst Inst, Loop *L, Region *R) {
+void ScopInfo::buildAccessSingleDim(MemAccInst Inst, Loop *L) {
   Value *Address = Inst.getPointerOperand();
   Value *Val = Inst.getValueOperand();
   Type *ElementType = Val->getType();
@@ -4554,8 +4555,9 @@ void ScopInfo::buildAccessSingleDim(MemA
       isVariantInNonAffineLoop = true;
 
   InvariantLoadsSetTy AccessILS;
-  bool IsAffine = !isVariantInNonAffineLoop &&
-                  isAffineExpr(R, L, AccessFunction, *SE, &AccessILS);
+  bool IsAffine =
+      !isVariantInNonAffineLoop &&
+      isAffineExpr(&scop->getRegion(), L, AccessFunction, *SE, &AccessILS);
 
   const InvariantLoadsSetTy &ScopRIL = scop->getRequiredInvariantLoads();
   for (LoadInst *LInst : AccessILS)
@@ -4569,39 +4571,39 @@ void ScopInfo::buildAccessSingleDim(MemA
                  {AccessFunction}, {}, Val);
 }
 
-void ScopInfo::buildMemoryAccess(MemAccInst Inst, Loop *L, Region *R) {
+void ScopInfo::buildMemoryAccess(MemAccInst Inst, Loop *L) {
 
-  if (buildAccessMemIntrinsic(Inst, L, R))
+  if (buildAccessMemIntrinsic(Inst, L))
     return;
 
-  if (buildAccessCallInst(Inst, L, R))
+  if (buildAccessCallInst(Inst, L))
     return;
 
-  if (buildAccessMultiDimFixed(Inst, L, R))
+  if (buildAccessMultiDimFixed(Inst, L))
     return;
 
-  if (buildAccessMultiDimParam(Inst, L, R))
+  if (buildAccessMultiDimParam(Inst, L))
     return;
 
-  buildAccessSingleDim(Inst, L, R);
+  buildAccessSingleDim(Inst, L);
 }
 
-void ScopInfo::buildAccessFunctions(Region &R, Region &SR) {
+void ScopInfo::buildAccessFunctions(Region &SR) {
 
   if (scop->isNonAffineSubRegion(&SR)) {
     for (BasicBlock *BB : SR.blocks())
-      buildAccessFunctions(R, *BB, &SR);
+      buildAccessFunctions(*BB, &SR);
     return;
   }
 
   for (auto I = SR.element_begin(), E = SR.element_end(); I != E; ++I)
     if (I->isSubRegion())
-      buildAccessFunctions(R, *I->getNodeAs<Region>());
+      buildAccessFunctions(*I->getNodeAs<Region>());
     else
-      buildAccessFunctions(R, *I->getNodeAs<BasicBlock>());
+      buildAccessFunctions(*I->getNodeAs<BasicBlock>());
 }
 
-void ScopInfo::buildStmts(Region &R, Region &SR) {
+void ScopInfo::buildStmts(Region &SR) {
 
   if (scop->isNonAffineSubRegion(&SR)) {
     scop->addScopStmt(nullptr, &SR);
@@ -4610,17 +4612,16 @@ void ScopInfo::buildStmts(Region &R, Reg
 
   for (auto I = SR.element_begin(), E = SR.element_end(); I != E; ++I)
     if (I->isSubRegion())
-      buildStmts(R, *I->getNodeAs<Region>());
+      buildStmts(*I->getNodeAs<Region>());
     else
       scop->addScopStmt(I->getNodeAs<BasicBlock>(), nullptr);
 }
 
-void ScopInfo::buildAccessFunctions(Region &R, BasicBlock &BB,
-                                    Region *NonAffineSubRegion,
+void ScopInfo::buildAccessFunctions(BasicBlock &BB, Region *NonAffineSubRegion,
                                     bool IsExitBlock) {
   // We do not build access functions for error blocks, as they may contain
   // instructions we can not model.
-  if (isErrorBlock(BB, R, *LI, *DT) && !IsExitBlock)
+  if (isErrorBlock(BB, scop->getRegion(), *LI, *DT) && !IsExitBlock)
     return;
 
   Loop *L = LI->getLoopFor(&BB);
@@ -4628,14 +4629,14 @@ void ScopInfo::buildAccessFunctions(Regi
   for (Instruction &Inst : BB) {
     PHINode *PHI = dyn_cast<PHINode>(&Inst);
     if (PHI)
-      buildPHIAccesses(PHI, R, NonAffineSubRegion, IsExitBlock);
+      buildPHIAccesses(PHI, NonAffineSubRegion, IsExitBlock);
 
     // For the exit block we stop modeling after the last PHI node.
     if (!PHI && IsExitBlock)
       break;
 
     if (auto MemInst = MemAccInst::dyn_cast(Inst))
-      buildMemoryAccess(MemInst, L, &R);
+      buildMemoryAccess(MemInst, L);
 
     if (isIgnoredIntrinsic(&Inst))
       continue;
@@ -4829,8 +4830,8 @@ void ScopInfo::addPHIReadAccess(PHINode
 void ScopInfo::buildScop(Region &R, AssumptionCache &AC) {
   scop.reset(new Scop(R, *SE, *LI, *SD->getDetectionContext(&R)));
 
-  buildStmts(R, R);
-  buildAccessFunctions(R, R);
+  buildStmts(R);
+  buildAccessFunctions(R);
 
   // In case the region does not have an exiting block we will later (during
   // code generation) split the exit block. This will move potential PHI nodes
@@ -4840,7 +4841,7 @@ void ScopInfo::buildScop(Region &R, Assu
   // accesses. Note that we do not model anything in the exit block if we have
   // an exiting block in the region, as there will not be any splitting later.
   if (!scop->hasSingleExitEdge())
-    buildAccessFunctions(R, *R.getExit(), nullptr,
+    buildAccessFunctions(*R.getExit(), nullptr,
                          /* IsExitBlock */ true);
 
   // Create memory accesses for global reads since all arrays are now known.




More information about the llvm-commits mailing list