From f084edd0b43fcb26a5a2e49c77a580497f780056 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Wed, 22 Oct 2014 23:00:03 +0000 Subject: [PATCH] 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 --- polly/lib/Analysis/Dependences.cpp | 26 ++++++++++++++++++++------ polly/lib/Analysis/ScopDetection.cpp | 2 +- polly/lib/CodeGen/CodeGeneration.cpp | 2 +- polly/lib/Support/SCEVValidator.cpp | 14 +++++++++++--- 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/polly/lib/Analysis/Dependences.cpp b/polly/lib/Analysis/Dependences.cpp index 827143f7c309..b82474319392 100644 --- a/polly/lib/Analysis/Dependences.cpp +++ b/polly/lib/Analysis/Dependences.cpp @@ -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); diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index 234aa6356ac4..fb9e65f39a8f 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -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; } diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp index 421aa79e7740..d58d40d2ac50 100644 --- a/polly/lib/CodeGen/CodeGeneration.cpp +++ b/polly/lib/CodeGen/CodeGeneration.cpp @@ -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()); diff --git a/polly/lib/Support/SCEVValidator.cpp b/polly/lib/Support/SCEVValidator.cpp index 3a8895f6cadd..6c38782ea9da 100644 --- a/polly/lib/Support/SCEVValidator.cpp +++ b/polly/lib/Support/SCEVValidator.cpp @@ -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(); }