[polly] r220441 - Use braces in multi-statement DEBUG() code [NFC]

Tobias Grosser tobias at grosser.es
Wed Oct 22 16:00:03 PDT 2014


Author: grosser
Date: Wed Oct 22 18:00:03 2014
New Revision: 220441

URL: http://llvm.org/viewvc/llvm-project?rev=220441&view=rev
Log:
Use braces in multi-statement DEBUG() code [NFC]

By adding braces into the DEBUG statement we can make clang-format format code
such as:

  DEBUG(stmt1(); stmt2())

as multi-line code:

  DEBUG({
    stmt1();
    stmt2();
  });

This makes control-flow in debug statements easier to read.

Modified:
    polly/trunk/lib/Analysis/Dependences.cpp
    polly/trunk/lib/Analysis/ScopDetection.cpp
    polly/trunk/lib/CodeGen/CodeGeneration.cpp
    polly/trunk/lib/Support/SCEVValidator.cpp

Modified: polly/trunk/lib/Analysis/Dependences.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/Dependences.cpp?rev=220441&r1=220440&r2=220441&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/Dependences.cpp (original)
+++ polly/trunk/lib/Analysis/Dependences.cpp Wed Oct 22 18:00:03 2014
@@ -309,7 +309,11 @@ void Dependences::calculateDependences(S
       isl_union_map_domain(isl_union_map_copy(StmtSchedule)));
   STMT_WAR = isl_union_map_intersect_domain(isl_union_map_copy(WAR),
                                             isl_union_map_domain(StmtSchedule));
-  DEBUG(dbgs() << "Wrapped Dependences:\n"; printScop(dbgs()); dbgs() << "\n");
+  DEBUG({
+    dbgs() << "Wrapped Dependences:\n";
+    printScop(dbgs());
+    dbgs() << "\n";
+  });
 
   // To handle reduction dependences we proceed as follows:
   // 1) Aggregate all possible reduction dependences, namely all self
@@ -352,8 +356,11 @@ void Dependences::calculateDependences(S
     addPrivatizationDependences();
   }
 
-  DEBUG(dbgs() << "Final Wrapped Dependences:\n"; printScop(dbgs());
-        dbgs() << "\n");
+  DEBUG({
+    dbgs() << "Final Wrapped Dependences:\n";
+    printScop(dbgs());
+    dbgs() << "\n";
+  });
 
   // RED_SIN is used to collect all reduction dependences again after we
   // split them according to the causing memory accesses. The current assumption
@@ -397,7 +404,11 @@ void Dependences::calculateDependences(S
   RED = isl_union_map_zip(RED);
   TC_RED = isl_union_map_zip(TC_RED);
 
-  DEBUG(dbgs() << "Zipped Dependences:\n"; printScop(dbgs()); dbgs() << "\n");
+  DEBUG({
+    dbgs() << "Zipped Dependences:\n";
+    printScop(dbgs());
+    dbgs() << "\n";
+  });
 
   RAW = isl_union_set_unwrap(isl_union_map_domain(RAW));
   WAW = isl_union_set_unwrap(isl_union_map_domain(WAW));
@@ -405,8 +416,11 @@ void Dependences::calculateDependences(S
   RED = isl_union_set_unwrap(isl_union_map_domain(RED));
   TC_RED = isl_union_set_unwrap(isl_union_map_domain(TC_RED));
 
-  DEBUG(dbgs() << "Unwrapped Dependences:\n"; printScop(dbgs());
-        dbgs() << "\n");
+  DEBUG({
+    dbgs() << "Unwrapped Dependences:\n";
+    printScop(dbgs());
+    dbgs() << "\n";
+  });
 
   RAW = isl_union_map_union(RAW, STMT_RAW);
   WAW = isl_union_map_union(WAW, STMT_WAW);

Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=220441&r1=220440&r2=220441&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Wed Oct 22 18:00:03 2014
@@ -813,7 +813,7 @@ bool ScopDetection::isValidRegion(Detect
   DEBUG(dbgs() << "Checking region: " << R.getNameStr() << "\n\t");
 
   if (R.isTopLevelRegion()) {
-    DEBUG(dbgs() << "Top level region is invalid"; dbgs() << "\n");
+    DEBUG(dbgs() << "Top level region is invalid\n");
     return false;
   }
 

Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=220441&r1=220440&r2=220441&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Wed Oct 22 18:00:03 2014
@@ -822,7 +822,7 @@ int ClastStmtCodeGen::getNumberOfIterati
 }
 
 void ClastStmtCodeGen::codegenForVector(const clast_for *F) {
-  DEBUG(dbgs() << "Vectorizing loop '" << F->iterator << "'\n";);
+  DEBUG(dbgs() << "Vectorizing loop '" << F->iterator << "'\n");
   int VectorWidth = getNumberOfIterations(F);
 
   Value *LB = ExpGen.codegen(F->LB, getIntPtrTy());

Modified: polly/trunk/lib/Support/SCEVValidator.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/SCEVValidator.cpp?rev=220441&r1=220440&r2=220441&view=diff
==============================================================================
--- polly/trunk/lib/Support/SCEVValidator.cpp (original)
+++ polly/trunk/lib/Support/SCEVValidator.cpp Wed Oct 22 18:00:03 2014
@@ -471,12 +471,20 @@ bool isAffineExpr(const Region *R, const
     return false;
 
   SCEVValidator Validator(R, SE, BaseAddress);
-  DEBUG(dbgs() << "\n"; dbgs() << "Expr: " << *Expr << "\n";
-        dbgs() << "Region: " << R->getNameStr() << "\n"; dbgs() << " -> ");
+  DEBUG({
+    dbgs() << "\n";
+    dbgs() << "Expr: " << *Expr << "\n";
+    dbgs() << "Region: " << R->getNameStr() << "\n";
+    dbgs() << " -> ";
+  });
 
   ValidatorResult Result = Validator.visit(Expr);
 
-  DEBUG(if (Result.isValid()) dbgs() << "VALID\n"; dbgs() << "\n";);
+  DEBUG({
+    if (Result.isValid())
+      dbgs() << "VALID\n";
+    dbgs() << "\n";
+  });
 
   return Result.isValid();
 }





More information about the llvm-commits mailing list