From 9d80930e950214d026afd3a3d18cda32629efdb9 Mon Sep 17 00:00:00 2001 From: Jeff Cohen Date: Sat, 23 Apr 2005 21:38:35 +0000 Subject: [PATCH] Eliminate tabs and trailing spaces git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21480 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Instrumentation/EmitFunctions.cpp | 14 +- .../ProfilePaths/CombineBranch.cpp | 88 ++++----- .../Instrumentation/ProfilePaths/EdgeCode.cpp | 18 +- .../Instrumentation/ProfilePaths/Graph.cpp | 48 ++--- .../Instrumentation/ProfilePaths/Graph.h | 10 +- .../ProfilePaths/GraphAuxiliary.cpp | 170 +++++++++--------- .../ProfilePaths/InstLoops.cpp | 18 +- .../ProfilePaths/RetracePath.cpp | 42 ++--- .../Instrumentation/TraceBasicBlocks.cpp | 2 +- .../Instrumentation/TraceValues.cpp | 2 +- lib/Transforms/Scalar/ADCE.cpp | 2 +- .../Scalar/InstructionCombining.cpp | 6 +- lib/Transforms/Scalar/LoopUnroll.cpp | 2 +- lib/Transforms/Scalar/SCCP.cpp | 16 +- lib/Transforms/Utils/CloneTrace.cpp | 18 +- lib/VMCore/BasicBlock.cpp | 4 +- lib/VMCore/Dominators.cpp | 4 +- 17 files changed, 232 insertions(+), 232 deletions(-) diff --git a/lib/Transforms/Instrumentation/EmitFunctions.cpp b/lib/Transforms/Instrumentation/EmitFunctions.cpp index 369a784a4e3..a49129399d2 100644 --- a/lib/Transforms/Instrumentation/EmitFunctions.cpp +++ b/lib/Transforms/Instrumentation/EmitFunctions.cpp @@ -53,7 +53,7 @@ static char doDFS(BasicBlock * node,std::map &color){ if(color[BB]!=GREY && color[BB]!=BLACK){ if(!doDFS(BB, color)){ - return 0; + return 0; } } @@ -101,19 +101,19 @@ bool EmitFunctionTable::runOnModule(Module &M){ M.getGlobalList().push_back(gb); Constant *constArray = ConstantArray::get(ArrayType::get(Type::SByteTy, - sBCons.size()), - sBCons); + sBCons.size()), + sBCons); GlobalVariable *funcArray = new GlobalVariable(constArray->getType(), true, - GlobalValue::ExternalLinkage, - constArray, "llvmSimpleFunction"); + GlobalValue::ExternalLinkage, + constArray, "llvmSimpleFunction"); M.getGlobalList().push_back(funcArray); ConstantInt *cnst = ConstantSInt::get(Type::IntTy, counter); GlobalVariable *fnCount = new GlobalVariable(Type::IntTy, true, - GlobalValue::ExternalLinkage, - cnst, "llvmFunctionCount"); + GlobalValue::ExternalLinkage, + cnst, "llvmFunctionCount"); M.getGlobalList().push_back(fnCount); return true; // Always modifies program } diff --git a/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp b/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp index e592d286533..5e4264ebfd5 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp @@ -30,10 +30,10 @@ namespace { enum Color { WHITE, GREY, BLACK }; void getBackEdgesVisit(BasicBlock *u, - std::map &color, - std::map &d, - int &time, - std::map &be); + std::map &color, + std::map &d, + int &time, + std::map &be); void removeRedundant(std::map &be); public: bool runOnFunction(Function &F); @@ -55,7 +55,7 @@ void CombineBranches::getBackEdgesVisit(BasicBlock *u, std::map &color, std::map &d, int &time, - std::map &be) { + std::map &be) { color[u]=GREY; time++; @@ -71,7 +71,7 @@ void CombineBranches::getBackEdgesVisit(BasicBlock *u, else if(color[BB]==GREY){ //so v is ancestor of u if time of u > time of v if(d[u] >= d[BB]) // u->BB is a backedge - be[u] = BB; + be[u] = BB; } } color[u]=BLACK;//done with visiting the node and its neighbors @@ -85,7 +85,7 @@ void CombineBranches::removeRedundant(std::map &be){ std::map seenBB; for(std::map::iterator MI = be.begin(), - ME = be.end(); MI != ME; ++MI){ + ME = be.end(); MI != ME; ++MI){ if(seenBB[MI->second]) continue; @@ -96,13 +96,13 @@ void CombineBranches::removeRedundant(std::map &be){ sameTarget.clear(); for(std::map::iterator MMI = be.begin(), - MME = be.end(); MMI != MME; ++MMI){ + MME = be.end(); MMI != MME; ++MMI){ if(MMI->first == MI->first) - continue; + continue; if(MMI->second == MI->second) - sameTarget.push_back(MMI->first); + sameTarget.push_back(MMI->first); } @@ -117,49 +117,49 @@ void CombineBranches::removeRedundant(std::map &be){ std::map > phiMap; for(std::vector::iterator VBI = sameTarget.begin(), - VBE = sameTarget.end(); VBI != VBE; ++VBI){ + VBE = sameTarget.end(); VBI != VBE; ++VBI){ - BranchInst *ti = cast((*VBI)->getTerminator()); - unsigned char index = 1; - if(ti->getSuccessor(0) == MI->second) - index = 0; + BranchInst *ti = cast((*VBI)->getTerminator()); + unsigned char index = 1; + if(ti->getSuccessor(0) == MI->second) + index = 0; - ti->setSuccessor(index, newBB); + ti->setSuccessor(index, newBB); - for(BasicBlock::iterator BB2Inst = MI->second->begin(), - BBend = MI->second->end(); BB2Inst != BBend; ++BB2Inst){ - - if (PHINode *phiInst = dyn_cast(BB2Inst)){ - int bbIndex; - bbIndex = phiInst->getBasicBlockIndex(*VBI); - if(bbIndex>=0) - phiMap[phiInst].push_back(bbIndex); - } - } + for(BasicBlock::iterator BB2Inst = MI->second->begin(), + BBend = MI->second->end(); BB2Inst != BBend; ++BB2Inst){ + + if (PHINode *phiInst = dyn_cast(BB2Inst)){ + int bbIndex; + bbIndex = phiInst->getBasicBlockIndex(*VBI); + if(bbIndex>=0) + phiMap[phiInst].push_back(bbIndex); + } + } } for(std::map >::iterator - PI = phiMap.begin(), PE = phiMap.end(); PI != PE; ++PI){ - - PHINode *phiNode = new PHINode(PI->first->getType(), "phi", newBranch); - for(std::vector::iterator II = PI->second.begin(), - IE = PI->second.end(); II != IE; ++II){ - phiNode->addIncoming(PI->first->getIncomingValue(*II), - PI->first->getIncomingBlock(*II)); - } + PI = phiMap.begin(), PE = phiMap.end(); PI != PE; ++PI){ - std::vector tempBB; - for(std::vector::iterator II = PI->second.begin(), - IE = PI->second.end(); II != IE; ++II){ - tempBB.push_back(PI->first->getIncomingBlock(*II)); - } + PHINode *phiNode = new PHINode(PI->first->getType(), "phi", newBranch); + for(std::vector::iterator II = PI->second.begin(), + IE = PI->second.end(); II != IE; ++II){ + phiNode->addIncoming(PI->first->getIncomingValue(*II), + PI->first->getIncomingBlock(*II)); + } - for(std::vector::iterator II = tempBB.begin(), - IE = tempBB.end(); II != IE; ++II){ - PI->first->removeIncomingValue(*II); - } + std::vector tempBB; + for(std::vector::iterator II = PI->second.begin(), + IE = PI->second.end(); II != IE; ++II){ + tempBB.push_back(PI->first->getIncomingBlock(*II)); + } - PI->first->addIncoming(phiNode, newBB); + for(std::vector::iterator II = tempBB.begin(), + IE = tempBB.end(); II != IE; ++II){ + PI->first->removeIncomingValue(*II); + } + + PI->first->addIncoming(phiNode, newBB); } } } diff --git a/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp b/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp index aef4681f305..95822df002a 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp @@ -59,7 +59,7 @@ static void getTriggerCode(Module *M, BasicBlock *BB, int MethNo, Value *pathNo, //get the code to be inserted on the edge //This is determined from cond (1-6) void getEdgeCode::getCode(Instruction *rInst, Value *countInst, - Function *M, BasicBlock *BB, + Function *M, BasicBlock *BB, vector &retVec){ //Instruction *InsertPos = BB->getInstList().begin(); @@ -143,7 +143,7 @@ void getEdgeCode::getCode(Instruction *rInst, Value *countInst, retVec.push_back(trAddIndex); //insert trigger //getTriggerCode(M->getParent(), BB, MethNo, - // ConstantSInt::get(Type::IntTy,inc), newCount, triggerInst); + // ConstantSInt::get(Type::IntTy,inc), newCount, triggerInst); //end trigger code assert(inc>=0 && "IT MUST BE POSITIVE NOW"); @@ -164,7 +164,7 @@ void getEdgeCode::getCode(Instruction *rInst, Value *countInst, //now load count[addIndex] Instruction *castInst=new CastInst(addIndex, - Type::LongTy,"ctin");//, InsertPos); + Type::LongTy,"ctin");//, InsertPos); BB->getInstList().push_back(castInst); vector tmpVec; @@ -252,8 +252,8 @@ void getEdgeCode::getCode(Instruction *rInst, Value *countInst, //Count is an array, where Count[k] represents //the number of executions of path k void insertInTopBB(BasicBlock *front, - int k, - Instruction *rVar, Value *threshold){ + int k, + Instruction *rVar, Value *threshold){ //rVar is variable r, //countVar is count[] @@ -281,10 +281,10 @@ void insertInTopBB(BasicBlock *front, //insert a basic block with appropriate code //along a given edge void insertBB(Edge ed, - getEdgeCode *edgeCode, - Instruction *rInst, - Value *countInst, - int numPaths, int Methno, Value *threshold){ + getEdgeCode *edgeCode, + Instruction *rInst, + Value *countInst, + int numPaths, int Methno, Value *threshold){ BasicBlock* BB1=ed.getFirst()->getElement(); BasicBlock* BB2=ed.getSecond()->getElement(); diff --git a/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp b/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp index 21883c41b0c..c8b1a0dfce0 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp @@ -22,7 +22,7 @@ using std::vector; namespace llvm { const graphListElement *findNodeInList(const Graph::nodeList &NL, - Node *N) { + Node *N) { for(Graph::nodeList::const_iterator NI = NL.begin(), NE=NL.end(); NI != NE; ++NI) if (*NI->element== *N) @@ -39,7 +39,7 @@ graphListElement *findNodeInList(Graph::nodeList &NL, Node *N) { //graph constructor with root and exit specified Graph::Graph(std::vector n, std::vector e, - Node *rt, Node *lt){ + Node *rt, Node *lt){ strt=rt; ext=lt; for(vector::iterator x=n.begin(), en=n.end(); x!=en; ++x) @@ -297,9 +297,9 @@ int Graph::getNumberOfIncomingEdges(Node *nd){ Node *lnode=EI->first; const nodeList &nl = getNodeList(lnode); for(Graph::nodeList::const_iterator NI = nl.begin(), NE=nl.end(); NI != NE; - ++NI) + ++NI) if (*NI->element== *nd) - count++; + count++; } return count; } @@ -400,8 +400,8 @@ Graph* Graph::getMaxSpanningTree(){ //remove u frm vt for(vector::iterator VI=vt.begin(), VE=vt.end(); VI!=VE; ++VI){ if(**VI==*u){ - vt.erase(VI); - break; + vt.erase(VI); + break; } } @@ -414,10 +414,10 @@ Graph* Graph::getMaxSpanningTree(){ //check if v is in vt bool contains=false; for(vector::iterator VI=vt.begin(), VE=vt.end(); VI!=VE; ++VI){ - if(**VI==*v){ - contains=true; - break; - } + if(**VI==*v){ + contains=true; + break; + } } DEBUG(std::cerr<<"wt:v->wt"<getWeight()<<"\n"; printNode(v);std::cerr<<"node wt:"<<(*v).weight<<"\n"); @@ -425,11 +425,11 @@ Graph* Graph::getMaxSpanningTree(){ //so if v in in vt, change wt(v) to wt(u->v) //only if wt(u->v)getWeight()){ - parent[v]=u; - ed_weight[v]=weight; - v->setWeight(weight); + parent[v]=u; + ed_weight[v]=weight; + v->setWeight(weight); - DEBUG(std::cerr<getWeight()<<":Set weight------\n"; + DEBUG(std::cerr<getWeight()<<":Set weight------\n"; printGraph(); printEdge(Edge(u,v,weight))); } @@ -447,7 +447,7 @@ void Graph::printGraph(){ Graph::nodeList &nl = getNodeList(*LI); for(Graph::nodeList::iterator NI=nl.begin(), NE=nl.end(); NI!=NE; ++NI){ std::cerr<<":"<<"("<<(NI->element->getElement()) - ->getName()<<":"<element->getWeight()<<","<weight<<")"; + ->getName()<<":"<element->getWeight()<<","<weight<<")"; } std::cerr<<"--------\n"; } @@ -494,9 +494,9 @@ void Graph::makeUnDirectional(){ for(nodeList::iterator NLI=nl.begin(), NLE=nl.end(); NLI!=NLE; ++NLI){ Edge ed(NLI->element, *NI, NLI->weight); if(!hasEdgeAndWt(ed)){ - DEBUG(std::cerr<<"######doesn't hv\n"; + DEBUG(std::cerr<<"######doesn't hv\n"; printEdge(ed)); - addEdgeForce(ed); + addEdgeForce(ed); } } } @@ -511,7 +511,7 @@ void Graph::reverseWts(){ ++NI) { nodeList &node_list = getNodeList(*NI); for(nodeList::iterator NLI=nodes[*NI].begin(), NLE=nodes[*NI].end(); - NLI!=NLE; ++NLI) + NLI!=NLE; ++NLI) NLI->weight=-NLI->weight; } } @@ -538,8 +538,8 @@ void Graph::getBackEdges(vector &be, std::map &d){ //helper function to get back edges: it is called by //the "getBackEdges" function above void Graph::getBackEdgesVisit(Node *u, vector &be, - std::map &color, - std::map &d, int &time) { + std::map &color, + std::map &d, int &time) { color[u]=GREY; time++; d[u]=time; @@ -547,7 +547,7 @@ void Graph::getBackEdgesVisit(Node *u, vector &be, vector &succ_list = getNodeList(u); for(vector::iterator vl=succ_list.begin(), - ve=succ_list.end(); vl!=ve; ++vl){ + ve=succ_list.end(); vl!=ve; ++vl){ Node *v=vl->element; if(color[v]!=GREY && color[v]!=BLACK){ getBackEdgesVisit(v, be, color, d, time); @@ -557,9 +557,9 @@ void Graph::getBackEdgesVisit(Node *u, vector &be, if(color[v]==GREY){ //so v is ancestor of u if time of u > time of v if(d[u] >= d[v]){ - Edge *ed=new Edge(u, v,vl->weight, vl->randId); - if (!(*u == *getExit() && *v == *getRoot())) - be.push_back(*ed); // choose the forward edges + Edge *ed=new Edge(u, v,vl->weight, vl->randId); + if (!(*u == *getExit() && *v == *getRoot())) + be.push_back(*ed); // choose the forward edges } } } diff --git a/lib/Transforms/Instrumentation/ProfilePaths/Graph.h b/lib/Transforms/Instrumentation/ProfilePaths/Graph.h index 203948454c7..9782ab49172 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/Graph.h +++ b/lib/Transforms/Instrumentation/ProfilePaths/Graph.h @@ -233,10 +233,10 @@ private: //So we have a back edge when we meet a successor of //a node with smaller time, and GREY color void getBackEdgesVisit(Node *u, - std::vector &be, - std::map &clr, - std::map &d, - int &time); + std::vector &be, + std::map &clr, + std::map &d, + int &time); public: typedef nodeMapTy::iterator elementIterator; @@ -251,7 +251,7 @@ public: //constructor with root and exit node specified Graph(std::vector n, - std::vector e, Node *rt, Node *lt); + std::vector e, Node *rt, Node *lt); //add a node void addNode(Node *nd); diff --git a/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp b/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp index bd7bf4fe9e0..4ca1c5b92fe 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp @@ -40,10 +40,10 @@ static void getChords(vector &chords, Graph &g, Graph st){ ++NI){ Graph::nodeList node_list=g.getNodeList(*NI); for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end(); - NLI!=NLE; ++NLI){ + NLI!=NLE; ++NLI){ Edge f(*NI, NLI->element,NLI->weight, NLI->randId); if(!(st.hasEdgeAndWt(f)))//addnl - chords.push_back(f); + chords.push_back(f); } } } @@ -60,7 +60,7 @@ static void removeTreeEdges(Graph &g, Graph& t){ for(vector::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE; ++NI){ Graph::nodeList nl=t.getNodeList(*NI); - for(Graph::nodeList::iterator NLI=nl.begin(), NLE=nl.end(); NLI!=NLE;++NLI){ + for(Graph::nodeList::iterator NLI=nl.begin(), NLE=nl.end(); NLI!=NLE;++NLI){ Edge ed(NLI->element, *NI, NLI->weight); if(!g.hasEdgeAndWt(ed)) t.removeEdge(ed);//tree has only one edge //between any pair of vertices, so no need to delete by edge wt @@ -91,8 +91,8 @@ int valueAssignmentToEdges(Graph& g, map nodePriority, int sz=nlist.size(); for(int i=0;igetElement(); BasicBlock *bb2 = nlist[min].element->getElement(); @@ -123,16 +123,16 @@ int valueAssignmentToEdges(Graph& g, map nodePriority, } } - graphListElement tempEl=nlist[min]; - nlist[min]=nlist[i]; - nlist[i]=tempEl; + graphListElement tempEl=nlist[min]; + nlist[min]=nlist[i]; + nlist[i]=tempEl; } //sorted now! for(Graph::nodeList::iterator GLI=nlist.begin(), GLE=nlist.end(); - GLI!=GLE; ++GLI){ - GLI->weight=NumPaths[*RI]; - NumPaths[*RI]+=NumPaths[GLI->element]; + GLI!=GLE; ++GLI){ + GLI->weight=NumPaths[*RI]; + NumPaths[*RI]+=NumPaths[GLI->element]; } } } @@ -154,9 +154,9 @@ static int inc_Dir(Edge e, Edge f){ //check that the edges must have at least one common endpoint assert(*(e.getFirst())==*(f.getFirst()) || - *(e.getFirst())==*(f.getSecond()) || - *(e.getSecond())==*(f.getFirst()) || - *(e.getSecond())==*(f.getSecond())); + *(e.getFirst())==*(f.getSecond()) || + *(e.getSecond())==*(f.getFirst()) || + *(e.getSecond())==*(f.getSecond())); if(*(e.getFirst())==*(f.getSecond()) || *(e.getSecond())==*(f.getFirst())) @@ -169,7 +169,7 @@ static int inc_Dir(Edge e, Edge f){ //used for getting edge increments (read comments above in inc_Dir) //inc_DFS is a modification of DFS static void inc_DFS(Graph& g,Graph& t,map& Increment, - int events, Node *v, Edge e){ + int events, Node *v, Edge e){ vector allNodes=t.getAllNodes(); @@ -177,12 +177,12 @@ static void inc_DFS(Graph& g,Graph& t,map& Increment, ++NI){ Graph::nodeList node_list=t.getNodeList(*NI); for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end(); - NLI!= NLE; ++NLI){ + NLI!= NLE; ++NLI){ Edge f(*NI, NLI->element,NLI->weight, NLI->randId); if(!edgesEqual(f,e) && *v==*(f.getSecond())){ - int dir_count=inc_Dir(e,f); - int wt=1*f.getWeight(); - inc_DFS(g,t, Increment, dir_count*events+wt, f.getFirst(), f); + int dir_count=inc_Dir(e,f); + int wt=1*f.getWeight(); + inc_DFS(g,t, Increment, dir_count*events+wt, f.getFirst(), f); } } } @@ -191,13 +191,13 @@ static void inc_DFS(Graph& g,Graph& t,map& Increment, ++NI){ Graph::nodeList node_list=t.getNodeList(*NI); for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end(); - NLI!=NLE; ++NLI){ + NLI!=NLE; ++NLI){ Edge f(*NI, NLI->element,NLI->weight, NLI->randId); if(!edgesEqual(f,e) && *v==*(f.getFirst())){ - int dir_count=inc_Dir(e,f); - int wt=f.getWeight(); - inc_DFS(g,t, Increment, dir_count*events+wt, - f.getSecond(), f); + int dir_count=inc_Dir(e,f); + int wt=f.getWeight(); + inc_DFS(g,t, Increment, dir_count*events+wt, + f.getSecond(), f); } } } @@ -207,12 +207,12 @@ static void inc_DFS(Graph& g,Graph& t,map& Increment, ++NI){ Graph::nodeList node_list=g.getNodeList(*NI); for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end(); - NLI!=NLE; ++NLI){ + NLI!=NLE; ++NLI){ Edge f(*NI, NLI->element,NLI->weight, NLI->randId); if(!(t.hasEdgeAndWt(f)) && (*v==*(f.getSecond()) || - *v==*(f.getFirst()))){ - int dir_count=inc_Dir(e,f); - Increment[f]+=dir_count*events; + *v==*(f.getFirst()))){ + int dir_count=inc_Dir(e,f); + Increment[f]+=dir_count*events; } } } @@ -234,10 +234,10 @@ static map getEdgeIncrements(Graph& g, Graph& t, Graph::nodeList node_list=g.getSortedNodeList(*NI, be); //modified g.getNodeList(*NI); for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end(); - NLI!=NLE; ++NLI){ + NLI!=NLE; ++NLI){ Edge ed(*NI, NLI->element,NLI->weight,NLI->randId); if(!(t.hasEdgeAndWt(ed))){ - Increment[ed]=0;; + Increment[ed]=0;; } } } @@ -250,11 +250,11 @@ static map getEdgeIncrements(Graph& g, Graph& t, Graph::nodeList node_list=g.getSortedNodeList(*NI, be); //modified g.getNodeList(*NI); for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end(); - NLI!=NLE; ++NLI){ + NLI!=NLE; ++NLI){ Edge ed(*NI, NLI->element,NLI->weight, NLI->randId); if(!(t.hasEdgeAndWt(ed))){ - int wt=ed.getWeight(); - Increment[ed]+=wt; + int wt=ed.getWeight(); + Increment[ed]+=wt; } } } @@ -264,7 +264,7 @@ static map getEdgeIncrements(Graph& g, Graph& t, //push it up: TODO const graphListElement *findNodeInList(const Graph::nodeList &NL, - Node *N); + Node *N); graphListElement *findNodeInList(Graph::nodeList &NL, Node *N); //end TODO @@ -287,33 +287,33 @@ static void getCodeInsertions(Graph &g, map & Graph::nodeList succs=g.getNodeList(v); for(Graph::nodeList::iterator nl=succs.begin(), ne=succs.end(); - nl!=ne; ++nl){ + nl!=ne; ++nl){ int edgeWt=nl->weight; Node *w=nl->element; //if chords has v->w Edge ed(v,w, edgeWt, nl->randId); bool hasEdge=false; for(vector::iterator CI=chords.begin(), CE=chords.end(); - CI!=CE && !hasEdge;++CI){ - if(*CI==ed && CI->getWeight()==edgeWt){//modf - hasEdge=true; - } + CI!=CE && !hasEdge;++CI){ + if(*CI==ed && CI->getWeight()==edgeWt){//modf + hasEdge=true; + } } if(hasEdge){//so its a chord edge - getEdgeCode *edCd=new getEdgeCode(); - edCd->setCond(1); - edCd->setInc(edIncrements[ed]); - instr[ed]=edCd; + getEdgeCode *edCd=new getEdgeCode(); + edCd->setCond(1); + edCd->setInc(edIncrements[ed]); + instr[ed]=edCd; } else if(g.getNumberOfIncomingEdges(w)==1){ - ws.push_back(w); + ws.push_back(w); } else{ - getEdgeCode *edCd=new getEdgeCode(); - edCd->setCond(2); - edCd->setInc(0); - instr[ed]=edCd; + getEdgeCode *edCd=new getEdgeCode(); + edCd->setCond(2); + edCd->setInc(0); + instr[ed]=edCd; } } } @@ -335,7 +335,7 @@ static void getCodeInsertions(Graph &g, map & //graphListElement *N = findNodeInList(nl, w); for(Graph::nodeList::const_iterator N = nl.begin(), NNEN = nl.end(); N!= NNEN; ++N){ - if (*N->element == *w){ + if (*N->element == *w){ Node *v=lnode; //if chords has v->w @@ -388,8 +388,8 @@ static void getCodeInsertions(Graph &g, map & //and outgoing dummy edge is a->exit //changed void addDummyEdges(vector &stDummy, - vector &exDummy, - Graph &g, vector &be){ + vector &exDummy, + Graph &g, vector &be){ for(vector::iterator VI=be.begin(), VE=be.end(); VI!=VE; ++VI){ Edge ed=*VI; Node *first=ed.getFirst(); @@ -414,7 +414,7 @@ void addDummyEdges(vector &stDummy, void printEdge(Edge ed){ cerr<<((ed.getFirst())->getElement()) ->getName()<<"->"<<((ed.getSecond()) - ->getElement())->getName()<< + ->getElement())->getName()<< ":"< &stDummy, vector &exDummy, vector &be, map &insertions, - Graph &g){ + Graph &g){ typedef vector::iterator vec_iter; map temp; //iterate over edges with code std::vector toErase; for(map::iterator MI=insertions.begin(), - ME=insertions.end(); MI!=ME; ++MI){ + ME=insertions.end(); MI!=ME; ++MI){ Edge ed=MI->first; getEdgeCode *edCd=MI->second; @@ -439,26 +439,26 @@ static void moveDummyCode(vector &stDummy, //iterate over be, and check if its starts and end vertices hv code for(vector::iterator BEI=be.begin(), BEE=be.end(); BEI!=BEE; ++BEI){ if(ed.getRandId()==BEI->getRandId()){ - - if(temp[*BEI]==0) - temp[*BEI]=new getEdgeCode(); - - //so ed is either in st, or ex! - if(ed.getFirst()==g.getRoot()){ - //so its in stDummy - temp[*BEI]->setCdIn(edCd); - toErase.push_back(ed); - } - else if(ed.getSecond()==g.getExit()){ + if(temp[*BEI]==0) + temp[*BEI]=new getEdgeCode(); - //so its in exDummy - toErase.push_back(ed); - temp[*BEI]->setCdOut(edCd); - } - else{ - assert(false && "Not found in either start or end! Rand failed?"); - } + //so ed is either in st, or ex! + if(ed.getFirst()==g.getRoot()){ + + //so its in stDummy + temp[*BEI]->setCdIn(edCd); + toErase.push_back(ed); + } + else if(ed.getSecond()==g.getExit()){ + + //so its in exDummy + toErase.push_back(ed); + temp[*BEI]->setCdOut(edCd); + } + else{ + assert(false && "Not found in either start or end! Rand failed?"); + } } } } @@ -485,12 +485,12 @@ static void moveDummyCode(vector &stDummy, //appropriate code insertions etc and insert the code at //appropriate locations void processGraph(Graph &g, - Instruction *rInst, - Value *countInst, - vector& be, - vector& stDummy, - vector& exDummy, - int numPaths, int MethNo, + Instruction *rInst, + Value *countInst, + vector& be, + vector& stDummy, + vector& exDummy, + int numPaths, int MethNo, Value *threshold){ //Given a graph: with exit->root edge, do the following in seq: @@ -621,7 +621,7 @@ void processGraph(Graph &g, //print edges with code for debugging cerr<<"Code inserted in following---------------\n"; for(map::iterator cd_i=codeInsertions.begin(), - cd_e=codeInsertions.end(); cd_i!=cd_e; ++cd_i){ + cd_e=codeInsertions.end(); cd_i!=cd_e; ++cd_i){ printEdge(cd_i->first); cerr<second->getCond()<<":"<second->getInc()<<"\n"; } @@ -639,10 +639,10 @@ void processGraph(Graph &g, //debugging info cerr<<"After moving dummy code\n"; for(map::iterator cd_i=codeInsertions.begin(), - cd_e=codeInsertions.end(); cd_i != cd_e; ++cd_i){ + cd_e=codeInsertions.end(); cd_i != cd_e; ++cd_i){ printEdge(cd_i->first); cerr<second->getCond()<<":" - <second->getInc()<<"\n"; + <second->getInc()<<"\n"; } cerr<<"Dummy end------------\n"; #endif @@ -651,7 +651,7 @@ void processGraph(Graph &g, //see what it looks like... //now insert code along edges which have codes on them for(map::iterator MI=codeInsertions.begin(), - ME=codeInsertions.end(); MI!=ME; ++MI){ + ME=codeInsertions.end(); MI!=ME; ++MI){ Edge ed=MI->first; insertBB(ed, MI->second, rInst, countInst, numPaths, MethNo, threshold); } @@ -666,10 +666,10 @@ void printGraph(Graph &g){ cerr<<((*LI)->getElement())->getName()<<"->"; Graph::nodeList nl=g.getNodeList(*LI); for(Graph::nodeList::iterator NI=nl.begin(); - NI!=nl.end(); ++NI){ + NI!=nl.end(); ++NI){ cerr<<":"<<"("<<(NI->element->getElement()) - ->getName()<<":"<element->getWeight()<<","<weight<<"," - <randId<<")"; + ->getName()<<":"<element->getWeight()<<","<weight<<"," + <randId<<")"; } cerr<<"\n"; } diff --git a/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp b/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp index fc828977f68..860b57f7e4f 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp @@ -45,9 +45,9 @@ namespace { Function *inCountMth; DominatorSet *DS; void getBackEdgesVisit(BasicBlock *u, - std::map &color, - std::map &d, - int &time, BBMap &be); + std::map &color, + std::map &d, + int &time, BBMap &be); void removeRedundant(BBMap &be); void findAndInstrumentBackEdges(Function &F); public: @@ -79,8 +79,8 @@ void InstLoops::getBackEdgesVisit(BasicBlock *u, else if(color[BB]==GREY){ //so v is ancestor of u if time of u > time of v if(d[u] >= d[BB]){ - //u->BB is a backedge - be[u] = BB; + //u->BB is a backedge + be[u] = BB; } } } @@ -92,13 +92,13 @@ void InstLoops::getBackEdgesVisit(BasicBlock *u, void InstLoops::removeRedundant(BBMap &be) { std::vector toDelete; for(std::map::iterator MI = be.begin(), - ME = be.end(); MI != ME; ++MI) + ME = be.end(); MI != ME; ++MI) for(BBMap::iterator MMI = be.begin(), MME = be.end(); MMI != MME; ++MMI) if(DS->properlyDominates(MI->first, MMI->first)) - toDelete.push_back(MMI->first); + toDelete.push_back(MMI->first); // Remove all the back-edges we found from be. for(std::vector::iterator VI = toDelete.begin(), - VE = toDelete.end(); VI != VE; ++VI) + VE = toDelete.end(); VI != VE; ++VI) be.erase(*VI); } @@ -123,7 +123,7 @@ void InstLoops::findAndInstrumentBackEdges(Function &F){ removeRedundant(be); for(std::map::iterator MI = be.begin(), - ME = be.end(); MI != ME; ++MI){ + ME = be.end(); MI != ME; ++MI){ BasicBlock *u = MI->first; BasicBlock *BB = MI->second; // We have a back-edge from BB --> u. diff --git a/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp b/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp index c92094015de..8c343df8f69 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp @@ -26,9 +26,9 @@ namespace llvm { //Routines to get the path trace! void getPathFrmNode(Node *n, vector &vBB, int pathNo, Graph &g, - vector &stDummy, vector &exDummy, - vector &be, - double strand){ + vector &stDummy, vector &exDummy, + vector &be, + double strand){ Graph::nodeList &nlist = g.getNodeList(n); //printGraph(g); @@ -48,7 +48,7 @@ void getPathFrmNode(Node *n, vector &vBB, int pathNo, Graph &g, nextRoot=NLI->element; edgeRnd=NLI->randId; if(isStart) - strand=NLI->randId; + strand=NLI->randId; } } @@ -66,43 +66,43 @@ void getPathFrmNode(Node *n, vector &vBB, int pathNo, Graph &g, bool has1=false, has2=false; //check if exit has it for(vector::iterator VI=exDummy.begin(), VE=exDummy.end(); VI!=VE; - ++VI){ + ++VI){ if(VI->getRandId()==edgeRnd){ - has2=true; - break; + has2=true; + break; } } //check if start has it for(vector::iterator VI=stDummy.begin(), VE=stDummy.end(); VI!=VE; - ++VI){ + ++VI){ if(VI->getRandId()==strand){ - has1=true; - break; + has1=true; + break; } } if(has1){ //find backedge with endpoint vBB[1] for(vector::iterator VI=be.begin(), VE=be.end(); VI!=VE; ++VI){ - assert(vBB.size()>0 && "vector too small"); - if( VI->getSecond()->getElement() == vBB[1] ){ - //vBB[0]=VI->getFirst()->getElement(); + assert(vBB.size()>0 && "vector too small"); + if( VI->getSecond()->getElement() == vBB[1] ){ + //vBB[0]=VI->getFirst()->getElement(); vBB.erase(vBB.begin()); - break; - } + break; + } } } if(has2){ //find backedge with startpoint vBB[vBB.size()-1] for(vector::iterator VI=be.begin(), VE=be.end(); VI!=VE; ++VI){ - assert(vBB.size()>0 && "vector too small"); - if( VI->getFirst()->getElement() == vBB[vBB.size()-1] && + assert(vBB.size()>0 && "vector too small"); + if( VI->getFirst()->getElement() == vBB[vBB.size()-1] && VI->getSecond()->getElement() == vBB[0]){ - //vBB.push_back(VI->getSecond()->getElement()); - break; - } + //vBB.push_back(VI->getSecond()->getElement()); + break; + } } } else @@ -114,7 +114,7 @@ void getPathFrmNode(Node *n, vector &vBB, int pathNo, Graph &g, assert(pathNo-maxCount>=0); return getPathFrmNode(nextRoot, vBB, pathNo-maxCount, g, stDummy, - exDummy, be, strand); + exDummy, be, strand); } diff --git a/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp b/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp index ae8a8bdb73c..9018ee6c2bd 100644 --- a/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp +++ b/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp @@ -36,7 +36,7 @@ namespace { ModulePass *llvm::createTraceBasicBlockPass() { - return new TraceBasicBlocks(); + return new TraceBasicBlocks(); } static void InsertInstrumentationCall (BasicBlock *BB, diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp index 586c923077b..9838ea101ac 100644 --- a/lib/Transforms/Instrumentation/TraceValues.cpp +++ b/lib/Transforms/Instrumentation/TraceValues.cpp @@ -33,7 +33,7 @@ DisablePtrHashing("tracedisablehashdisable", cl::Hidden, static cl::list TraceFuncNames("tracefunc", cl::desc("Only trace specific functions in the " "-trace or -tracem passes"), - cl::value_desc("function"), cl::Hidden); + cl::value_desc("function"), cl::Hidden); static void TraceValuesAtBBExit(BasicBlock *BB, Function *Printf, Function* HashPtrToSeqNum, diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index a2ca367c458..7307ff813a2 100644 --- a/lib/Transforms/Scalar/ADCE.cpp +++ b/lib/Transforms/Scalar/ADCE.cpp @@ -229,7 +229,7 @@ bool ADCE::doADCE() { isa(I) || isa(I)) { // FIXME: Unreachable instructions should not be marked intrinsically // live here. - markInstructionLive(I); + markInstructionLive(I); } else if (isInstructionTriviallyDead(I)) { // Remove the instruction from it's basic block... BB->getInstList().erase(I); diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 7c5cfa823a4..766cf017326 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -2896,7 +2896,7 @@ Instruction *InstCombiner::visitSetCondInst(BinaryOperator &I) { I.getName()), I); } } - + if (Op1) return new SelectInst(LHSI->getOperand(0), Op1, Op2); break; @@ -4640,9 +4640,9 @@ static Constant *GetGEPGlobalInitializer(Constant *C, ConstantExpr *CE) { if (ConstantStruct *CS = dyn_cast(C)) { C = CS->getOperand(El); } else if (isa(C)) { - C = Constant::getNullValue(STy->getElementType(El)); + C = Constant::getNullValue(STy->getElementType(El)); } else if (isa(C)) { - C = UndefValue::get(STy->getElementType(El)); + C = UndefValue::get(STy->getElementType(El)); } else { return 0; } diff --git a/lib/Transforms/Scalar/LoopUnroll.cpp b/lib/Transforms/Scalar/LoopUnroll.cpp index 45b81f7e39c..75df8bb7281 100644 --- a/lib/Transforms/Scalar/LoopUnroll.cpp +++ b/lib/Transforms/Scalar/LoopUnroll.cpp @@ -88,7 +88,7 @@ static unsigned ApproximateLoopSize(const Loop *L) { } else if (I->hasOneUse() && I->use_back() == Term) { // Ignore instructions only used by the loop terminator. } else if (DbgInfoIntrinsic *DbgI = dyn_cast(I)) { - // Ignore debug instructions + // Ignore debug instructions } else { ++Size; } diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 384c00d1ceb..d9d74ca8ea9 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -835,13 +835,13 @@ void SCCPSolver::visitLoadInst(LoadInst &I) { // Transform load (constantexpr_GEP global, 0, ...) into the value loaded. if (ConstantExpr *CE = dyn_cast(Ptr)) if (CE->getOpcode() == Instruction::GetElementPtr) - if (GlobalVariable *GV = dyn_cast(CE->getOperand(0))) - if (GV->isConstant() && !GV->isExternal()) - if (Constant *V = - GetGEPGlobalInitializer(GV->getInitializer(), CE)) { - markConstant(IV, &I, V); - return; - } + if (GlobalVariable *GV = dyn_cast(CE->getOperand(0))) + if (GV->isConstant() && !GV->isExternal()) + if (Constant *V = + GetGEPGlobalInitializer(GV->getInitializer(), CE)) { + markConstant(IV, &I, V); + return; + } } // Otherwise we cannot say for certain what value this load will produce. @@ -915,7 +915,7 @@ void SCCPSolver::visitCallSite(CallSite CS) { void SCCPSolver::Solve() { // Process the work lists until they are empty! while (!BBWorkList.empty() || !InstWorkList.empty() || - !OverdefinedInstWorkList.empty()) { + !OverdefinedInstWorkList.empty()) { // Process the instruction work list... while (!OverdefinedInstWorkList.empty()) { Value *I = OverdefinedInstWorkList.back(); diff --git a/lib/Transforms/Utils/CloneTrace.cpp b/lib/Transforms/Utils/CloneTrace.cpp index 5eca653fa4f..5bfd9893d70 100644 --- a/lib/Transforms/Utils/CloneTrace.cpp +++ b/lib/Transforms/Utils/CloneTrace.cpp @@ -33,7 +33,7 @@ llvm::CloneTrace(const std::vector &origTrace) { //this loop. To fix the phi nodes, we delete incoming branches //that are not in the trace. for(std::vector::const_iterator T = origTrace.begin(), - End = origTrace.end(); T != End; ++T) { + End = origTrace.end(); T != End; ++T) { //Clone Basic Block BasicBlock *clonedBlock = @@ -67,19 +67,19 @@ llvm::CloneTrace(const std::vector &origTrace) { //Second loop to do the remapping for(std::vector::const_iterator BB = clonedTrace.begin(), - BE = clonedTrace.end(); BB != BE; ++BB) { + BE = clonedTrace.end(); BB != BE; ++BB) { for(BasicBlock::iterator I = (*BB)->begin(); I != (*BB)->end(); ++I) { //Loop over all the operands of the instruction for(unsigned op=0, E = I->getNumOperands(); op != E; ++op) { - const Value *Op = I->getOperand(op); - - //Get it out of the value map - Value *V = ValueMap[Op]; + const Value *Op = I->getOperand(op); - //If not in the value map, then its outside our trace so ignore - if(V != 0) - I->setOperand(op,V); + //Get it out of the value map + Value *V = ValueMap[Op]; + + //If not in the value map, then its outside our trace so ignore + if(V != 0) + I->setOperand(op,V); } } } diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp index a9fb9247c1f..98d12d8f138 100644 --- a/lib/VMCore/BasicBlock.cpp +++ b/lib/VMCore/BasicBlock.cpp @@ -138,7 +138,7 @@ void BasicBlock::removePredecessor(BasicBlock *Pred, bool DontDeleteUselessPHIs) { assert((hasNUsesOrMore(16)||// Reduce cost of this assertion for complex CFGs. find(pred_begin(this), pred_end(this), Pred) != pred_end(this)) && - "removePredecessor: BB is not a predecessor!"); + "removePredecessor: BB is not a predecessor!"); if (InstList.empty()) return; PHINode *APN = dyn_cast(&front()); @@ -209,7 +209,7 @@ void BasicBlock::removePredecessor(BasicBlock *Pred, BasicBlock *BasicBlock::splitBasicBlock(iterator I, const std::string &BBName) { assert(getTerminator() && "Can't use splitBasicBlock on degenerate BB!"); assert(I != InstList.end() && - "Trying to get me to create degenerate basic block!"); + "Trying to get me to create degenerate basic block!"); BasicBlock *New = new BasicBlock(BBName, getParent(), getNext()); diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp index 220c7d9997b..a59bd4eb065 100644 --- a/lib/VMCore/Dominators.cpp +++ b/lib/VMCore/Dominators.cpp @@ -258,7 +258,7 @@ bool DominatorSet::runOnFunction(Function &F) { Roots.clear(); Roots.push_back(Root); assert(pred_begin(Root) == pred_end(Root) && - "Root node has predecessors in function!"); + "Root node has predecessors in function!"); ImmediateDominators &ID = getAnalysis(); Doms.clear(); @@ -448,7 +448,7 @@ DominanceFrontier::calculate(const DominatorTree &DT, DomSetType::const_iterator CDFI = ChildDF.begin(), CDFE = ChildDF.end(); for (; CDFI != CDFE; ++CDFI) { if (!Node->dominates(DT[*CDFI])) - S.insert(*CDFI); + S.insert(*CDFI); } }