[llvm-commits] [polly] r171241 - in /polly/trunk/lib: Analysis/Dependences.cpp Analysis/ScopDetection.cpp Analysis/ScopGraphPrinter.cpp Analysis/ScopInfo.cpp Analysis/TempScopInfo.cpp CodeGen/BlockGenerators.cpp CodeGen/Cloog.cpp CodeGen/CodeGeneration.cpp CodeGen/IslCodeGeneration.cpp CodeGen/LoopGenerators.cpp
Tobias Grosser
grosser at fim.uni-passau.de
Sat Dec 29 15:47:39 PST 2012
Author: grosser
Date: Sat Dec 29 17:47:38 2012
New Revision: 171241
URL: http://llvm.org/viewvc/llvm-project?rev=171241&view=rev
Log:
Fix obvious formatting problems.
We fix the following formatting problems found by clang-format:
- 80 cols violations
- Obvious problems with missing or too many spaces
- multiple new lines in a row
clang-format suggests many more changes, most of them falling in the following
two categories:
1) clang-format does not at all format a piece of code nicely
2) The style that clang-format suggests does not match the style used in
Polly/LLVM
I consider differences caused by reason 1) bugs, which should be fixed by
improving clang-format. Differences due to 2) need to be investigated closer
to understand the cause of the difference and the solution that should be taken.
Modified:
polly/trunk/lib/Analysis/Dependences.cpp
polly/trunk/lib/Analysis/ScopDetection.cpp
polly/trunk/lib/Analysis/ScopGraphPrinter.cpp
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/Analysis/TempScopInfo.cpp
polly/trunk/lib/CodeGen/BlockGenerators.cpp
polly/trunk/lib/CodeGen/Cloog.cpp
polly/trunk/lib/CodeGen/CodeGeneration.cpp
polly/trunk/lib/CodeGen/IslCodeGeneration.cpp
polly/trunk/lib/CodeGen/LoopGenerators.cpp
Modified: polly/trunk/lib/Analysis/Dependences.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/Dependences.cpp?rev=171241&r1=171240&r2=171241&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/Dependences.cpp (original)
+++ polly/trunk/lib/Analysis/Dependences.cpp Sat Dec 29 17:47:38 2012
@@ -53,9 +53,8 @@
RAW = WAR = WAW = NULL;
}
-void Dependences::collectInfo(Scop &S,
- isl_union_map **Read, isl_union_map **Write,
- isl_union_map **MayWrite,
+void Dependences::collectInfo(Scop &S, isl_union_map **Read,
+ isl_union_map **Write, isl_union_map **MayWrite,
isl_union_map **Schedule) {
isl_space *Space = S.getParamSpace();
*Read = isl_union_map_empty(isl_space_copy(Space));
@@ -268,7 +267,7 @@
isl_union_map_free(WAR);
isl_union_map_free(WAW);
- RAW = WAR = WAW = NULL;
+ RAW = WAR = WAW = NULL;
}
isl_union_map *Dependences::getDependences(int Kinds) {
Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=171241&r1=171240&r2=171241&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Sat Dec 29 17:47:38 2012
@@ -153,8 +153,8 @@
return InvalidRegions.find(R)->second;
}
-bool ScopDetection::isValidCFG(BasicBlock &BB, DetectionContext &Context) const
-{
+bool ScopDetection::isValidCFG(BasicBlock &BB,
+ DetectionContext &Context) const {
Region &RefRegion = Context.CurRegion;
TerminatorInst *TI = BB.getTerminator();
@@ -173,8 +173,7 @@
// UndefValue is not allowed as condition.
if (isa<UndefValue>(Condition))
- INVALID(AffFunc, "Condition based on 'undef' value in BB: "
- + BB.getName());
+ INVALID(AffFunc, "Condition based on 'undef' value in BB: " + BB.getName());
// Only Constant and ICmpInst are allowed as condition.
if (!(isa<Constant>(Condition) || isa<ICmpInst>(Condition)))
@@ -190,7 +189,7 @@
//
// TODO: This is not sufficient and just hides bugs. However it does pretty
// well.
- if(ICmp->isUnsigned())
+ if (ICmp->isUnsigned())
return false;
// Are both operands of the ICmp affine?
@@ -256,7 +255,8 @@
AccessFunction = SE->getMinusSCEV(AccessFunction, BasePointer);
- if (!isAffineExpr(&Context.CurRegion, AccessFunction, *SE, BaseValue) && !AllowNonAffine)
+ if (!isAffineExpr(&Context.CurRegion, AccessFunction, *SE, BaseValue) &&
+ !AllowNonAffine)
INVALID(AffFunc, "Non affine access function: " << *AccessFunction);
// FIXME: Alias Analysis thinks IntToPtrInst aliases with alloca instructions
@@ -285,7 +285,6 @@
return true;
}
-
bool ScopDetection::hasScalarDependency(Instruction &Inst,
Region &RefRegion) const {
for (Instruction::use_iterator UI = Inst.use_begin(), UE = Inst.use_end();
@@ -380,7 +379,7 @@
Region *ScopDetection::expandRegion(Region &R) {
// Initial no valid region was found (greater than R)
Region *LastValidRegion = NULL;
- Region *ExpandedRegion = R.getExpandedRegion();
+ Region *ExpandedRegion = R.getExpandedRegion();
DEBUG(dbgs() << "\tExpanding " << R.getNameStr() << "\n");
@@ -427,7 +426,6 @@
return LastValidRegion;
}
-
void ScopDetection::findScops(Region &R) {
DetectionContext Context(R, *AA, false /*verifying*/);
@@ -496,7 +494,7 @@
// PHI nodes are not allowed in the exit basic block.
if (BasicBlock *Exit = R.getExit()) {
BasicBlock::iterator I = Exit->begin();
- if (I != Exit->end() && isa<PHINode> (*I))
+ if (I != Exit->end() && isa<PHINode>(*I))
INVALID(Other, "PHI node in exit BB");
}
@@ -561,7 +559,7 @@
LineBegin = std::min(LineBegin, NewLine);
LineEnd = std::max(LineEnd, NewLine);
break;
- }
+ }
}
void ScopDetection::printLocations() {
@@ -594,7 +592,7 @@
if (OnlyFunction != "" && F.getName() != OnlyFunction)
return false;
- if(!isValidFunction(F))
+ if (!isValidFunction(F))
return false;
findScops(*TopRegion);
@@ -605,7 +603,6 @@
return false;
}
-
void polly::ScopDetection::verifyRegion(const Region &R) const {
assert(isMaxRegionInScop(R) && "Expect R is a valid region.");
DetectionContext Context(const_cast<Region&>(R), *AA, true /*verifying*/);
Modified: polly/trunk/lib/Analysis/ScopGraphPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopGraphPrinter.cpp?rev=171241&r1=171240&r2=171241&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopGraphPrinter.cpp (original)
+++ polly/trunk/lib/Analysis/ScopGraphPrinter.cpp Sat Dec 29 17:47:38 2012
@@ -166,7 +166,7 @@
}
};
-} //end namespace llvm
+} //end namespace llvm
struct ScopViewer
: public DOTGraphTraitsViewer<ScopDetection, false> {
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=171241&r1=171240&r2=171241&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Sat Dec 29 17:47:38 2012
@@ -230,17 +230,16 @@
isl_map_free(newAccessRelation);
}
-static void replace(std::string& str, const std::string& find,
- const std::string& replace) {
+static void replace(std::string &str, const std::string &find,
+ const std::string &replace) {
size_t pos = 0;
- while((pos = str.find(find, pos)) != std::string::npos)
- {
+ while ((pos = str.find(find, pos)) != std::string::npos) {
str.replace(pos, find.length(), replace);
pos += replace.length();
}
}
-static void makeIslCompatible(std::string& str) {
+static void makeIslCompatible(std::string &str) {
str.erase(0, 1);
replace(str, ".", "_");
replace(str, "\"", "_");
@@ -691,7 +690,7 @@
OS.indent(16) << "n/a\n";
for (MemoryAccessVec::const_iterator I = MemAccs.begin(), E = MemAccs.end();
- I != E; ++I)
+ I != E; ++I)
(*I)->print(OS);
}
@@ -742,7 +741,7 @@
void Scop::buildContext() {
isl_space *Space = isl_space_params_alloc(IslCtx, 0);
- Context = isl_set_universe (Space);
+ Context = isl_set_universe(Space);
}
void Scop::addParameterBounds() {
@@ -776,7 +775,6 @@
}
}
-
void Scop::realignParams() {
// Add all parameters into a common model.
isl_space *Space = isl_space_params_alloc(IslCtx, ParameterIds.size());
@@ -826,7 +824,7 @@
}
std::string Scop::getContextStr() const {
- return stringFromIslObj(Context);
+ return stringFromIslObj(Context);
}
std::string Scop::getNameStr() const {
@@ -875,13 +873,12 @@
void Scop::printStatements(raw_ostream &OS) const {
OS << "Statements {\n";
- for (const_iterator SI = begin(), SE = end();SI != SE; ++SI)
+ for (const_iterator SI = begin(), SE = end(); SI != SE; ++SI)
OS.indent(4) << (**SI);
OS.indent(4) << "}\n";
}
-
void Scop::print(raw_ostream &OS) const {
printContext(OS.indent(4));
printStatements(OS.indent(4));
@@ -964,8 +961,6 @@
isl_ctx_free(ctx);
}
-
-
void ScopInfo::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<LoopInfo>();
AU.addRequired<RegionInfo>();
Modified: polly/trunk/lib/Analysis/TempScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/TempScopInfo.cpp?rev=171241&r1=171240&r2=171241&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/TempScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/TempScopInfo.cpp Sat Dec 29 17:47:38 2012
@@ -146,7 +146,7 @@
}
void TempScopInfo::buildAffineCondition(Value &V, bool inverted,
- Comparison **Comp) const {
+ Comparison **Comp) const {
if (ConstantInt *C = dyn_cast<ConstantInt>(&V)) {
// If this is always true condition, we will create 1 >= 0,
// otherwise we will create 1 == 0.
Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=171241&r1=171240&r2=171241&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Sat Dec 29 17:47:38 2012
@@ -84,7 +84,7 @@
struct SCEVRewriter : public SCEVVisitor<SCEVRewriter, const SCEV*> {
public:
static const SCEV *rewrite(const SCEV *scev, Scop &S, ScalarEvolution &SE,
- ValueMapT &GlobalMap, ValueMapT &BBMap) {
+ ValueMapT &GlobalMap, ValueMapT &BBMap) {
SCEVRewriter Rewriter(S, SE, GlobalMap, BBMap);
return Rewriter.visit(scev);
}
@@ -257,12 +257,11 @@
IRBuilder<> &Builder;
std::vector<Value *> &IVS;
- static int mergeIslAffValues(__isl_take isl_set *Set,
- __isl_take isl_aff *Aff, void *User);
+ static int mergeIslAffValues(__isl_take isl_set *Set, __isl_take isl_aff *Aff,
+ void *User);
};
}
-
Value *IslGenerator::generateIslInt(isl_int Int) {
mpz_t IntMPZ;
mpz_init(IntMPZ);
@@ -523,8 +522,8 @@
return Builder.CreateStore(ValueOperand, NewPointer);
}
-void BlockGenerator::copyInstruction(const Instruction *Inst,
- ValueMapT &BBMap, ValueMapT &GlobalMap) {
+void BlockGenerator::copyInstruction(const Instruction *Inst, ValueMapT &BBMap,
+ ValueMapT &GlobalMap) {
// Terminator instructions control the control flow. They are explicitly
// expressed in the clast and do not need to be copied.
if (Inst->isTerminator())
@@ -546,7 +545,6 @@
copyInstScalar(Inst, BBMap, GlobalMap);
}
-
void BlockGenerator::copyBB(ValueMapT &GlobalMap) {
BasicBlock *BB = Statement.getBasicBlock();
BasicBlock *CopyBB = SplitBlock(Builder.GetInsertBlock(),
@@ -711,8 +709,7 @@
NewOpZero = getVectorValue(OpZero, VectorMap, ScalarMaps);
NewOpOne = getVectorValue(OpOne, VectorMap, ScalarMaps);
- Value *NewInst = Builder.CreateBinOp(Inst->getOpcode(), NewOpZero,
- NewOpOne,
+ Value *NewInst = Builder.CreateBinOp(Inst->getOpcode(), NewOpZero, NewOpOne,
Inst->getName() + "p_vec");
VectorMap[Inst] = NewInst;
}
@@ -740,8 +737,7 @@
Store->setAlignment(8);
} else {
for (unsigned i = 0; i < ScalarMaps.size(); i++) {
- Value *Scalar = Builder.CreateExtractElement(Vector,
- Builder.getInt32(i));
+ Value *Scalar = Builder.CreateExtractElement(Vector, Builder.getInt32(i));
Value *NewPointer = getNewValue(Pointer, ScalarMaps[i], GlobalMaps[i]);
Builder.CreateStore(Scalar, NewPointer);
}
Modified: polly/trunk/lib/CodeGen/Cloog.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/Cloog.cpp?rev=171241&r1=171240&r2=171241&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/Cloog.cpp (original)
+++ polly/trunk/lib/CodeGen/Cloog.cpp Sat Dec 29 17:47:38 2012
@@ -87,7 +87,6 @@
char buf[BUFFERSIZE + 1];
-
public:
FileToString() {
pipe(FD);
@@ -120,7 +119,6 @@
output += std::string(buf, readSize);
}
-
return output;
}
@@ -173,7 +171,7 @@
CloogDomain *Domain;
Scattering = cloog_scattering_from_isl_map(Stmt->getScattering());
- Domain = cloog_domain_from_isl_set(Stmt->getDomain());
+ Domain = cloog_domain_from_isl_set(Stmt->getDomain());
std::string entryName = Stmt->getBaseName();
@@ -354,7 +352,7 @@
Function *F = S.getRegion().getEntry()->getParent();
DEBUG(dbgs() << ":: " << F->getName());
- DEBUG(dbgs() << " : " << S.getRegion().getNameStr() << "\n");;
+ DEBUG(dbgs() << " : " << S.getRegion().getNameStr() << "\n");
DEBUG(C->pprint(dbgs()));
return false;
Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=171241&r1=171240&r2=171241&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Sat Dec 29 17:47:38 2012
@@ -176,7 +176,7 @@
&& "Clast reduction type not supported");
Value *old = codegen(r->elts[0], Ty);
- for (int i=1; i < r->n; ++i) {
+ for (int i = 1; i < r->n; ++i) {
Value *exprValue = codegen(r->elts[i], Ty);
switch (r->type) {
@@ -341,7 +341,7 @@
IntegerType *getIntPtrTy();
- public:
+public:
void codegen(const clast_root *r);
ClastStmtCodeGen(Scop *scop, IRBuilder<> &B, Pass *P);
@@ -357,7 +357,7 @@
}
void ClastStmtCodeGen::codegen(const clast_assignment *a) {
- Value *V= ExpGen.codegen(a->RHS, getIntPtrTy());
+ Value *V = ExpGen.codegen(a->RHS, getIntPtrTy());
ClastVars[a->LHS] = V;
}
@@ -425,7 +425,7 @@
VectorValueMapT VectorMap(VectorDimensions);
if (IVS) {
- assert (u->substitutions && "Substitutions expected!");
+ assert(u->substitutions && "Substitutions expected!");
int i = 0;
for (std::vector<Value*>::iterator II = IVS->begin(), IE = IVS->end();
II != IE; ++II) {
@@ -703,7 +703,7 @@
U = (const clast_user_stmt *) TmpStmt;
ScopStmt *Statement = (ScopStmt *) U->statement->usr;
for (unsigned i = 0; i < Statement->getNumIterators() - NonPLoopDepth; i++) {
- const Value* IV = Statement->getInductionVariableForDimension(i);
+ const Value *IV = Statement->getInductionVariableForDimension(i);
IVS.insert(const_cast<Value *>(IV));
}
@@ -784,7 +784,7 @@
APInt Stride = APInt_from_MPZ(F->stride);
IntegerType *LoopIVType = dyn_cast<IntegerType>(LB->getType());
- Stride = Stride.zext(LoopIVType->getBitWidth());
+ Stride = Stride.zext(LoopIVType->getBitWidth());
Value *StrideValue = ConstantInt::get(LoopIVType, Stride);
std::vector<Value*> IVS(VectorWidth);
@@ -811,7 +811,6 @@
ClastVars.erase(F->iterator);
}
-
bool ClastStmtCodeGen::isParallelFor(const clast_for *f) {
isl_set *Domain = isl_set_from_cloog_domain(f->domain);
assert(Domain && "Cannot access domain of loop");
@@ -952,14 +951,15 @@
codegen(stmt->next);
}
-ClastStmtCodeGen::ClastStmtCodeGen(Scop *scop, IRBuilder<> &B, Pass *P) :
- S(scop), P(P), Builder(B), ExpGen(Builder, ClastVars) {}
+ClastStmtCodeGen::ClastStmtCodeGen(Scop *scop, IRBuilder<> &B, Pass *P)
+ : S(scop), P(P), Builder(B), ExpGen(Builder, ClastVars) {
+}
namespace {
class CodeGeneration : public ScopPass {
std::vector<std::string> ParallelLoops;
- public:
+public:
static char ID;
CodeGeneration() : ScopPass(ID) {}
Modified: polly/trunk/lib/CodeGen/IslCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslCodeGeneration.cpp?rev=171241&r1=171240&r2=171241&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/IslCodeGeneration.cpp Sat Dec 29 17:47:38 2012
@@ -261,7 +261,7 @@
// result type cannot be larger than the type of the individual operand. isl
// does not calculate correct types for these operations and we consequently
// exclude those operations here.
- switch(OpType) {
+ switch (OpType) {
case isl_ast_op_pdiv_q:
case isl_ast_op_pdiv_r:
case isl_ast_op_div:
@@ -690,11 +690,10 @@
isl_map *S = isl_map_from_union_map(Schedule);
createSubstitutionsVector(isl_pw_multi_aff_copy(Info->PMA),
- isl_ast_build_copy(Info->Context),
- Stmt, VectorMap, IVS, IteratorID);
+ isl_ast_build_copy(Info->Context), Stmt, VectorMap,
+ IVS, IteratorID);
VectorBlockGenerator::generate(Builder, *Stmt, VectorMap, S, P);
-
isl_map_free(S);
isl_id_free(Annotation);
isl_id_free(Id);
@@ -754,8 +753,7 @@
for (int i = 0; i < isl_ast_node_list_n_ast_node(List); ++i)
createUserVector(isl_ast_node_list_get_ast_node(List, i), IVS,
- isl_id_copy(IteratorID),
- isl_union_map_copy(Schedule));
+ isl_id_copy(IteratorID), isl_union_map_copy(Schedule));
isl_ast_node_free(Body);
isl_ast_node_list_free(List);
@@ -892,10 +890,9 @@
}
void IslNodeBuilder::createSubstitutions(__isl_take isl_pw_multi_aff *PMA,
- __isl_take isl_ast_build *Context,
- ScopStmt *Stmt, ValueMapT &VMap) {
- for (unsigned i = 0; i < isl_pw_multi_aff_dim(PMA, isl_dim_out);
- ++i) {
+ __isl_take isl_ast_build *Context,
+ ScopStmt *Stmt, ValueMapT &VMap) {
+ for (unsigned i = 0; i < isl_pw_multi_aff_dim(PMA, isl_dim_out); ++i) {
isl_pw_aff *Aff;
isl_ast_expr *Expr;
const Value *OldIV;
@@ -926,8 +923,8 @@
for (std::vector<Value*>::iterator II = IVS.begin(), IE = IVS.end();
II != IE; ++II) {
IDToValue[IteratorID] = *II;
- createSubstitutions(isl_pw_multi_aff_copy(PMA),
- isl_ast_build_copy(Context), Stmt, VMap[i]);
+ createSubstitutions(isl_pw_multi_aff_copy(PMA), isl_ast_build_copy(Context),
+ Stmt, VMap[i]);
i++;
}
@@ -1017,7 +1014,7 @@
namespace {
class IslCodeGeneration : public ScopPass {
- public:
+public:
static char ID;
IslCodeGeneration() : ScopPass(ID) {}
Modified: polly/trunk/lib/CodeGen/LoopGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/LoopGenerators.cpp?rev=171241&r1=171240&r2=171241&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/LoopGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/LoopGenerators.cpp Sat Dec 29 17:47:38 2012
@@ -24,8 +24,7 @@
using namespace polly;
Value *polly::createLoop(Value *LB, Value *UB, Value *Stride,
- IRBuilder<> &Builder, Pass *P,
- BasicBlock *&AfterBlock,
+ IRBuilder<> &Builder, Pass *P, BasicBlock *&AfterBlock,
ICmpInst::Predicate Predicate) {
DominatorTree &DT = P->getAnalysis<DominatorTree>();
Function *F = Builder.GetInsertBlock()->getParent();
More information about the llvm-commits
mailing list