[polly] r267401 - Introduce a parameter set type [NFC]

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 06:33:07 PDT 2016


Author: jdoerfert
Date: Mon Apr 25 08:33:07 2016
New Revision: 267401

URL: http://llvm.org/viewvc/llvm-project?rev=267401&view=rev
Log:
Introduce a parameter set type [NFC]

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

Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=267401&r1=267400&r2=267401&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Mon Apr 25 08:33:07 2016
@@ -1862,7 +1862,7 @@ public:
   inline const ParamVecType &getParams() const { return Parameters; }
 
   /// @brief Take a list of parameters and add the new ones to the scop.
-  void addParams(std::vector<const SCEV *> NewParameters);
+  void addParams(const ParameterSetTy &NewParameters);
 
   int getNumArrays() { return ScopArrayInfoMap.size(); }
 

Modified: polly/trunk/include/polly/Support/SCEVValidator.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Support/SCEVValidator.h?rev=267401&r1=267400&r2=267401&view=diff
==============================================================================
--- polly/trunk/include/polly/Support/SCEVValidator.h (original)
+++ polly/trunk/include/polly/Support/SCEVValidator.h Mon Apr 25 08:33:07 2016
@@ -14,7 +14,6 @@
 
 #include "polly/Support/ScopHelper.h"
 #include "llvm/ADT/SetVector.h"
-#include <vector>
 
 namespace llvm {
 class Region;
@@ -60,12 +59,11 @@ bool isAffineExpr(const llvm::Region *R,
 /// @brief Check if @p V describes an affine parameter constraint in @p R.
 bool isAffineParamConstraint(llvm::Value *V, const llvm::Region *R,
                              llvm::Loop *Scope, llvm::ScalarEvolution &SE,
-                             std::vector<const llvm::SCEV *> &Params,
-                             bool OrExpr = false);
+                             ParameterSetTy &Params, bool OrExpr = false);
 
-std::vector<const llvm::SCEV *>
-getParamsInAffineExpr(const llvm::Region *R, llvm::Loop *Scope,
-                      const llvm::SCEV *Expression, llvm::ScalarEvolution &SE);
+ParameterSetTy getParamsInAffineExpr(const llvm::Region *R, llvm::Loop *Scope,
+                                     const llvm::SCEV *Expression,
+                                     llvm::ScalarEvolution &SE);
 
 /// @brief Extract the constant factors from the multiplication @p M.
 ///

Modified: polly/trunk/include/polly/Support/ScopHelper.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Support/ScopHelper.h?rev=267401&r1=267400&r2=267401&view=diff
==============================================================================
--- polly/trunk/include/polly/Support/ScopHelper.h (original)
+++ polly/trunk/include/polly/Support/ScopHelper.h Mon Apr 25 08:33:07 2016
@@ -41,6 +41,9 @@ using ValueMapT = llvm::DenseMap<llvm::A
 /// @brief Type for a set of invariant loads.
 using InvariantLoadsSetTy = llvm::SetVector<llvm::AssertingVH<llvm::LoadInst>>;
 
+/// @brief Set type for parameters.
+using ParameterSetTy = llvm::SetVector<const llvm::SCEV *>;
+
 /// @brief Utility proxy to wrap the common members of LoadInst and StoreInst.
 ///
 /// This works like the LLVM utility class CallSite, ie. it forwards all calls

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=267401&r1=267400&r2=267401&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Mon Apr 25 08:33:07 2016
@@ -1803,7 +1803,7 @@ const SCEV *Scop::getRepresentingInvaria
   return SCEVSensitiveParameterRewriter::rewrite(S, *SE, InvEquivClassVMap);
 }
 
-void Scop::addParams(std::vector<const SCEV *> NewParameters) {
+void Scop::addParams(const ParameterSetTy &NewParameters) {
   for (const SCEV *Parameter : NewParameters) {
     Parameter = extractConstantFactor(Parameter, *SE).second;
 
@@ -1873,15 +1873,15 @@ void Scop::addUserAssumptions(Assumption
 
     auto *L = LI.getLoopFor(CI->getParent());
     auto *Val = CI->getArgOperand(0);
-    std::vector<const SCEV *> Params;
-    if (!isAffineParamConstraint(Val, R, L, *SE, Params)) {
+    ParameterSetTy DetectedParams;
+    if (!isAffineParamConstraint(Val, R, L, *SE, DetectedParams)) {
       emitOptimizationRemarkAnalysis(F.getContext(), DEBUG_TYPE, F,
                                      CI->getDebugLoc(),
                                      "Non-affine user assumption ignored.");
       continue;
     }
 
-    addParams(Params);
+    addParams(DetectedParams);
 
     SmallVector<isl_set *, 2> ConditionSets;
     buildConditionSets(*Stmts.begin(), Val, nullptr, L, Context, ConditionSets);

Modified: polly/trunk/lib/Support/SCEVValidator.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/SCEVValidator.cpp?rev=267401&r1=267400&r2=267401&view=diff
==============================================================================
--- polly/trunk/lib/Support/SCEVValidator.cpp (original)
+++ polly/trunk/lib/Support/SCEVValidator.cpp Mon Apr 25 08:33:07 2016
@@ -5,7 +5,6 @@
 #include "llvm/Analysis/ScalarEvolution.h"
 #include "llvm/Analysis/ScalarEvolutionExpressions.h"
 #include "llvm/Support/Debug.h"
-#include <vector>
 
 using namespace llvm;
 using namespace polly;
@@ -41,7 +40,7 @@ class ValidatorResult {
   SCEVType::TYPE Type;
 
   /// @brief The set of Parameters in the expression.
-  std::vector<const SCEV *> Parameters;
+  ParameterSetTy Parameters;
 
 public:
   /// @brief The copy constructor
@@ -57,7 +56,7 @@ public:
 
   /// @brief Construct a result with a certain type and a single parameter.
   ValidatorResult(SCEVType::TYPE Type, const SCEV *Expr) : Type(Type) {
-    Parameters.push_back(Expr);
+    Parameters.insert(Expr);
   }
 
   /// @brief Get the type of the ValidatorResult.
@@ -79,12 +78,11 @@ public:
   bool isPARAM() { return Type == SCEVType::PARAM; }
 
   /// @brief Get the parameters of this validator result.
-  std::vector<const SCEV *> getParameters() { return Parameters; }
+  const ParameterSetTy &getParameters() { return Parameters; }
 
   /// @brief Add the parameters of Source to this result.
   void addParamsFrom(const ValidatorResult &Source) {
-    Parameters.insert(Parameters.end(), Source.Parameters.begin(),
-                      Source.Parameters.end());
+    Parameters.insert(Source.Parameters.begin(), Source.Parameters.end());
   }
 
   /// @brief Merge a result.
@@ -548,8 +546,7 @@ bool isAffineExpr(const Region *R, llvm:
 }
 
 static bool isAffineParamExpr(Value *V, const Region *R, Loop *Scope,
-                              ScalarEvolution &SE,
-                              std::vector<const SCEV *> &Params) {
+                              ScalarEvolution &SE, ParameterSetTy &Params) {
   auto *E = SE.getSCEV(V);
   if (isa<SCEVCouldNotCompute>(E))
     return false;
@@ -560,14 +557,14 @@ static bool isAffineParamExpr(Value *V,
     return false;
 
   auto ResultParams = Result.getParameters();
-  Params.insert(Params.end(), ResultParams.begin(), ResultParams.end());
+  Params.insert(ResultParams.begin(), ResultParams.end());
 
   return true;
 }
 
 bool isAffineParamConstraint(Value *V, const Region *R, llvm::Loop *Scope,
-                             ScalarEvolution &SE,
-                             std::vector<const SCEV *> &Params, bool OrExpr) {
+                             ScalarEvolution &SE, ParameterSetTy &Params,
+                             bool OrExpr) {
   if (auto *ICmp = dyn_cast<ICmpInst>(V)) {
     return isAffineParamConstraint(ICmp->getOperand(0), R, Scope, SE, Params,
                                    true) &&
@@ -589,11 +586,10 @@ bool isAffineParamConstraint(Value *V, c
   return isAffineParamExpr(V, R, Scope, SE, Params);
 }
 
-std::vector<const SCEV *> getParamsInAffineExpr(const Region *R, Loop *Scope,
-                                                const SCEV *Expr,
-                                                ScalarEvolution &SE) {
+ParameterSetTy getParamsInAffineExpr(const Region *R, Loop *Scope,
+                                     const SCEV *Expr, ScalarEvolution &SE) {
   if (isa<SCEVCouldNotCompute>(Expr))
-    return std::vector<const SCEV *>();
+    return ParameterSetTy();
 
   InvariantLoadsSetTy ILS;
   SCEVValidator Validator(R, Scope, SE, &ILS);




More information about the llvm-commits mailing list