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.

llvm-svn: 220441
This commit is contained in:
Tobias Grosser 2014-10-22 23:00:03 +00:00
parent ac7dc6e701
commit f084edd0b4
4 changed files with 33 additions and 11 deletions

View File

@ -309,7 +309,11 @@ void Dependences::calculateDependences(Scop &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(Scop &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(Scop &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(Scop &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);

View File

@ -813,7 +813,7 @@ bool ScopDetection::isValidRegion(DetectionContext &Context) const {
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;
}

View File

@ -822,7 +822,7 @@ int ClastStmtCodeGen::getNumberOfIterations(const clast_for *For) {
}
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());

View File

@ -471,12 +471,20 @@ bool isAffineExpr(const Region *R, const SCEV *Expr, ScalarEvolution &SE,
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();
}