[llvm-commits] [polly] r172486 - in /polly/trunk/lib/Analysis: ScopDetection.cpp ScopInfo.cpp

Tobias Grosser grosser at fim.uni-passau.de
Mon Jan 14 14:40:23 PST 2013


Author: grosser
Date: Mon Jan 14 16:40:23 2013
New Revision: 172486

URL: http://llvm.org/viewvc/llvm-project?rev=172486&view=rev
Log:
clang-format goodness

Modified:
    polly/trunk/lib/Analysis/ScopDetection.cpp
    polly/trunk/lib/Analysis/ScopInfo.cpp

Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=172486&r1=172485&r2=172486&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Mon Jan 14 16:40:23 2013
@@ -95,49 +95,48 @@
 
 STATISTIC(ValidRegion, "Number of regions that a valid part of Scop");
 
-#define BADSCOP_STAT(NAME, DESC) STATISTIC(Bad##NAME##ForScop, \
-                                           "Number of bad regions for Scop: "\
-                                           DESC)
-
-#define INVALID(NAME, MESSAGE) \
-  do { \
-    std::string Buf; \
-    raw_string_ostream fmt(Buf); \
-    fmt << MESSAGE; \
-    fmt.flush(); \
-    LastFailure = Buf; \
-    DEBUG(dbgs() << MESSAGE); \
-    DEBUG(dbgs() << "\n"); \
-    assert(!Context.Verifying && #NAME); \
-    if (!Context.Verifying) ++Bad##NAME##ForScop; \
-    return false; \
-  } while (0);
-
+#define BADSCOP_STAT(NAME, DESC)                                               \
+  STATISTIC(Bad##NAME##ForScop, "Number of bad regions for Scop: " DESC)
 
-#define INVALID_NOVERIFY(NAME, MESSAGE) \
-  do { \
-    std::string Buf; \
-    raw_string_ostream fmt(Buf); \
-    fmt << MESSAGE; \
-    fmt.flush(); \
-    LastFailure = Buf; \
-    DEBUG(dbgs() << MESSAGE); \
-    DEBUG(dbgs() << "\n"); \
-    /* DISABLED: assert(!Context.Verifying && #NAME); */ \
-    if (!Context.Verifying) ++Bad##NAME##ForScop; \
-    return false; \
+#define INVALID(NAME, MESSAGE)                                                 \
+  do {                                                                         \
+    std::string Buf;                                                           \
+    raw_string_ostream fmt(Buf);                                               \
+    fmt << MESSAGE;                                                            \
+    fmt.flush();                                                               \
+    LastFailure = Buf;                                                         \
+    DEBUG(dbgs() << MESSAGE);                                                  \
+    DEBUG(dbgs() << "\n");                                                     \
+    assert(!Context.Verifying && #NAME);                                       \
+    if (!Context.Verifying)                                                    \
+      ++Bad##NAME##ForScop;                                                    \
+    return false;                                                              \
   } while (0);
 
+#define INVALID_NOVERIFY(NAME, MESSAGE)                                        \
+  do {                                                                         \
+    std::string Buf;                                                           \
+    raw_string_ostream fmt(Buf);                                               \
+    fmt << MESSAGE;                                                            \
+    fmt.flush();                                                               \
+    LastFailure = Buf;                                                         \
+    DEBUG(dbgs() << MESSAGE);                                                  \
+    DEBUG(dbgs() << "\n");                                                     \
+    /* DISABLED: assert(!Context.Verifying && #NAME); */                       \
+    if (!Context.Verifying)                                                    \
+      ++Bad##NAME##ForScop;                                                    \
+    return false;                                                              \
+  } while (0);
 
-BADSCOP_STAT(CFG,             "CFG too complex");
-BADSCOP_STAT(IndVar,          "Non canonical induction variable in loop");
-BADSCOP_STAT(LoopBound,       "Loop bounds can not be computed");
-BADSCOP_STAT(FuncCall,        "Function call with side effects appeared");
-BADSCOP_STAT(AffFunc,         "Expression not affine");
-BADSCOP_STAT(Scalar,          "Found scalar dependency");
-BADSCOP_STAT(Alias,           "Found base address alias");
-BADSCOP_STAT(SimpleRegion,    "Region not simple");
-BADSCOP_STAT(Other,           "Others");
+BADSCOP_STAT(CFG, "CFG too complex");
+BADSCOP_STAT(IndVar, "Non canonical induction variable in loop");
+BADSCOP_STAT(LoopBound, "Loop bounds can not be computed");
+BADSCOP_STAT(FuncCall, "Function call with side effects appeared");
+BADSCOP_STAT(AffFunc, "Expression not affine");
+BADSCOP_STAT(Scalar, "Found scalar dependency");
+BADSCOP_STAT(Alias, "Found base address alias");
+BADSCOP_STAT(SimpleRegion, "Region not simple");
+BADSCOP_STAT(Other, "Others");
 
 //===----------------------------------------------------------------------===//
 // ScopDetection.
@@ -167,7 +166,8 @@
   if (!Br)
     INVALID(CFG, "Non branch instruction terminates BB: " + BB.getName());
 
-  if (Br->isUnconditional()) return true;
+  if (Br->isUnconditional())
+    return true;
 
   Value *Condition = Br->getCondition();
 
@@ -193,8 +193,8 @@
       return false;
 
     // Are both operands of the ICmp affine?
-    if (isa<UndefValue>(ICmp->getOperand(0))
-        || isa<UndefValue>(ICmp->getOperand(1)))
+    if (isa<UndefValue>(ICmp->getOperand(0)) ||
+        isa<UndefValue>(ICmp->getOperand(1)))
       INVALID(AffFunc, "undef operand in branch at BB: " + BB.getName());
 
     const SCEV *LHS = SE->getSCEV(ICmp->getOperand(0));

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=172486&r1=172485&r2=172486&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Mon Jan 14 16:40:23 2013
@@ -52,8 +52,8 @@
 using namespace llvm;
 using namespace polly;
 
-STATISTIC(ScopFound,  "Number of valid Scops");
-STATISTIC(RichScopFound,   "Number of Scops containing a loop");
+STATISTIC(ScopFound, "Number of valid Scops");
+STATISTIC(RichScopFound, "Number of Scops containing a loop");
 
 /// Translate a SCEVExpression into an isl_pw_aff object.
 struct SCEVAffinator : public SCEVVisitor<SCEVAffinator, isl_pw_aff*> {
@@ -337,9 +337,7 @@
   OS.indent(16) << getAccessRelationStr() << ";\n";
 }
 
-void MemoryAccess::dump() const {
-  print(errs());
-}
+void MemoryAccess::dump() const { print(errs()); }
 
 // Create a map in the size of the provided set domain, that maps from the
 // one element of the provided set domain to another element of the provided
@@ -437,9 +435,7 @@
 
 //===----------------------------------------------------------------------===//
 
-isl_map *ScopStmt::getScattering() const {
-  return isl_map_copy(Scattering);
-}
+isl_map *ScopStmt::getScattering() const { return isl_map_copy(Scattering); }
 
 void ScopStmt::setScattering(isl_map *NewScattering) {
   isl_map_free(Scattering);
@@ -458,8 +454,8 @@
 
   // Loop dimensions.
   for (unsigned i = 0; i < NbIterators; ++i)
-    Scattering = isl_map_equate(Scattering, isl_dim_out, 2 * i + 1,
-                                isl_dim_in, i);
+    Scattering = isl_map_equate(Scattering, isl_dim_out, 2 * i + 1, isl_dim_in,
+                                i);
 
   // Constant dimensions
   for (unsigned i = 0; i < NbIterators + 1; ++i)
@@ -587,11 +583,10 @@
   return Domain;
 }
 
-ScopStmt::ScopStmt(Scop &parent, TempScop &tempScop,
-                   const Region &CurRegion, BasicBlock &bb,
-                   SmallVectorImpl<Loop*> &NestLoops,
+ScopStmt::ScopStmt(Scop &parent, TempScop &tempScop, const Region &CurRegion,
+                   BasicBlock &bb, SmallVectorImpl<Loop *> &NestLoops,
                    SmallVectorImpl<unsigned> &Scatter)
-  : Parent(parent), BB(&bb), IVS(NestLoops.size()) {
+    : Parent(parent), BB(&bb), IVS(NestLoops.size()) {
   // Setup the induction variables.
   for (unsigned i = 0, e = NestLoops.size(); i < e; ++i) {
     PHINode *PN = NestLoops[i]->getCanonicalInductionVariable();
@@ -611,17 +606,13 @@
   buildAccesses(tempScop, CurRegion);
 }
 
-std::string ScopStmt::getDomainStr() const {
-  return stringFromIslObj(Domain);
-}
+std::string ScopStmt::getDomainStr() const { return stringFromIslObj(Domain); }
 
 std::string ScopStmt::getScatteringStr() const {
   return stringFromIslObj(Scattering);
 }
 
-unsigned ScopStmt::getNumParams() const {
-  return Parent.getNumParams();
-}
+unsigned ScopStmt::getNumParams() const { return Parent.getNumParams(); }
 
 unsigned ScopStmt::getNumIterators() const {
   // The final read has one dimension with one element.
@@ -637,8 +628,8 @@
 
 const char *ScopStmt::getBaseName() const { return BaseName.c_str(); }
 
-const PHINode *ScopStmt::getInductionVariableForDimension(unsigned Dimension)
-  const {
+const PHINode *ScopStmt::getInductionVariableForDimension(
+    unsigned Dimension) const {
   return IVS[Dimension].first;
 }
 
@@ -646,21 +637,15 @@
   return IVS[Dimension].second;
 }
 
-isl_ctx *ScopStmt::getIslCtx() const {
-  return Parent.getIslCtx();
-}
+isl_ctx *ScopStmt::getIslCtx() const { return Parent.getIslCtx(); }
 
-isl_set *ScopStmt::getDomain() const {
-  return isl_set_copy(Domain);
-}
+isl_set *ScopStmt::getDomain() const { return isl_set_copy(Domain); }
 
 isl_space *ScopStmt::getDomainSpace() const {
   return isl_set_get_space(Domain);
 }
 
-isl_id *ScopStmt::getDomainId() const {
-  return isl_set_get_tuple_id(Domain);
-}
+isl_id *ScopStmt::getDomainId() const { return isl_set_get_tuple_id(Domain); }
 
 ScopStmt::~ScopStmt() {
   while (!MemAccs.empty()) {
@@ -762,12 +747,12 @@
     isl_int_init(V);
 
     isl_int_set_si(V, 1);
-    isl_int_mul_2exp(V, V, Width-1);
+    isl_int_mul_2exp(V, V, Width - 1);
     isl_int_neg(V, V);
     isl_set_lower_bound(Context, isl_dim_param, i, V);
 
     isl_int_set_si(V, 1);
-    isl_int_mul_2exp(V, V, Width-1);
+    isl_int_mul_2exp(V, V, Width - 1);
     isl_int_sub_ui(V, V, 1);
     isl_set_upper_bound(Context, isl_dim_param, i, V);
 
@@ -823,9 +808,7 @@
     delete *I;
 }
 
-std::string Scop::getContextStr() const {
-  return stringFromIslObj(Context);
-}
+std::string Scop::getContextStr() const { return stringFromIslObj(Context); }
 
 std::string Scop::getNameStr() const {
   std::string ExitName, EntryName;
@@ -844,9 +827,7 @@
   return EntryName + "---" + ExitName;
 }
 
-__isl_give isl_set *Scop::getContext() const {
-  return isl_set_copy(Context);
-}
+__isl_give isl_set *Scop::getContext() const { return isl_set_copy(Context); }
 __isl_give isl_space *Scop::getParamSpace() const {
   return isl_set_get_space(this->Context);
 }
@@ -910,11 +891,9 @@
   return true;
 }
 
-void Scop::buildScop(TempScop &tempScop,
-                      const Region &CurRegion,
-                      SmallVectorImpl<Loop*> &NestLoops,
-                      SmallVectorImpl<unsigned> &Scatter,
-                      LoopInfo &LI) {
+void Scop::buildScop(TempScop &tempScop, const Region &CurRegion,
+                     SmallVectorImpl<Loop *> &NestLoops,
+                     SmallVectorImpl<unsigned> &Scatter, LoopInfo &LI) {
   Loop *L = castToLoop(CurRegion, LI);
 
   if (L)
@@ -947,7 +926,7 @@
   // Exiting a loop region.
   Scatter[loopDepth] = 0;
   NestLoops.pop_back();
-  ++Scatter[loopDepth-1];
+  ++Scatter[loopDepth - 1];
 }
 
 //===----------------------------------------------------------------------===//
@@ -983,7 +962,8 @@
 
   // Statistics.
   ++ScopFound;
-  if (tempScop->getMaxLoopDepth() > 0) ++RichScopFound;
+  if (tempScop->getMaxLoopDepth() > 0)
+    ++RichScopFound;
 
   scop = new Scop(*tempScop, LI, SE, ctx);
 





More information about the llvm-commits mailing list