[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp EdgeCode.cpp Graph.cpp Graph.h GraphAuxiliary.cpp InstLoops.cpp ProfilePaths.cpp RetracePath.cpp

Misha Brukman brukman at cs.uiuc.edu
Thu Apr 21 16:40:58 PDT 2005



Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths:

CombineBranch.cpp updated: 1.13 -> 1.14
EdgeCode.cpp updated: 1.28 -> 1.29
Graph.cpp updated: 1.19 -> 1.20
Graph.h updated: 1.12 -> 1.13
GraphAuxiliary.cpp updated: 1.26 -> 1.27
InstLoops.cpp updated: 1.19 -> 1.20
ProfilePaths.cpp updated: 1.42 -> 1.43
RetracePath.cpp updated: 1.11 -> 1.12
---
Log message:

Remove trailing whitespace


---
Diffs of the changes:  (+324 -324)

 CombineBranch.cpp  |   40 +++++------
 EdgeCode.cpp       |   94 +++++++++++++-------------
 Graph.cpp          |   74 ++++++++++-----------
 Graph.h            |   84 +++++++++++------------
 GraphAuxiliary.cpp |  186 ++++++++++++++++++++++++++---------------------------
 InstLoops.cpp      |   24 +++---
 ProfilePaths.cpp   |   58 ++++++++--------
 RetracePath.cpp    |   88 ++++++++++++-------------
 8 files changed, 324 insertions(+), 324 deletions(-)


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp:1.13 llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp:1.14
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp:1.13	Mon Dec 13 15:28:39 2004
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp	Thu Apr 21 18:40:47 2005
@@ -1,10 +1,10 @@
 //===-- CombineBranch.cpp -------------------------------------------------===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // Combine multiple back-edges going to the same sink into a single
@@ -31,14 +31,14 @@
 
     void getBackEdgesVisit(BasicBlock *u,
 			   std::map<BasicBlock *, Color > &color,
-			   std::map<BasicBlock *, int > &d, 
+			   std::map<BasicBlock *, int > &d,
 			   int &time,
 			   std::map<BasicBlock *, BasicBlock *> &be);
     void removeRedundant(std::map<BasicBlock *, BasicBlock *> &be);
   public:
     bool runOnFunction(Function &F);
   };
-  
+
   RegisterOpt<CombineBranches>
   X("branch-combine", "Multiple backedges going to same target are merged");
 }
@@ -53,10 +53,10 @@
 ///
 void CombineBranches::getBackEdgesVisit(BasicBlock *u,
                        std::map<BasicBlock *, Color > &color,
-                       std::map<BasicBlock *, int > &d, 
+                       std::map<BasicBlock *, int > &d,
                        int &time,
 		       std::map<BasicBlock *, BasicBlock *> &be) {
-  
+
   color[u]=GREY;
   time++;
   d[u]=time;
@@ -66,7 +66,7 @@
 
     if(color[BB]!=GREY && color[BB]!=BLACK)
       getBackEdgesVisit(BB, color, d, time, be);
-    
+
     //now checking for d and f vals
     else if(color[BB]==GREY){
       //so v is ancestor of u if time of u > time of v
@@ -83,29 +83,29 @@
 void CombineBranches::removeRedundant(std::map<BasicBlock *, BasicBlock *> &be){
   std::vector<BasicBlock *> toDelete;
   std::map<BasicBlock *, int> seenBB;
-  
-  for(std::map<BasicBlock *, BasicBlock *>::iterator MI = be.begin(), 
+
+  for(std::map<BasicBlock *, BasicBlock *>::iterator MI = be.begin(),
 	ME = be.end(); MI != ME; ++MI){
-    
+
     if(seenBB[MI->second])
       continue;
-    
+
     seenBB[MI->second] = 1;
 
     std::vector<BasicBlock *> sameTarget;
     sameTarget.clear();
-    
-    for(std::map<BasicBlock *, BasicBlock *>::iterator MMI = be.begin(), 
+
+    for(std::map<BasicBlock *, BasicBlock *>::iterator MMI = be.begin(),
 	  MME = be.end(); MMI != MME; ++MMI){
-      
+
       if(MMI->first == MI->first)
 	continue;
-      
+
       if(MMI->second == MI->second)
 	sameTarget.push_back(MMI->first);
-      
+
     }
-    
+
     //so more than one branch to same target
     if(sameTarget.size()){
 
@@ -126,9 +126,9 @@
 
 	ti->setSuccessor(index, newBB);
 
-	for(BasicBlock::iterator BB2Inst = MI->second->begin(), 
+	for(BasicBlock::iterator BB2Inst = MI->second->begin(),
 	      BBend = MI->second->end(); BB2Inst != BBend; ++BB2Inst){
-	  
+	
 	  if (PHINode *phiInst = dyn_cast<PHINode>(BB2Inst)){
 	    int bbIndex;
 	    bbIndex = phiInst->getBasicBlockIndex(*VBI);
@@ -178,7 +178,7 @@
   int time = 0;
   getBackEdgesVisit (F.begin (), color, d, time, be);
   removeRedundant (be);
-  
+
   return true; // FIXME: assumes a modification was always made.
 }
 


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.28 llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.29
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.28	Thu Jul 29 12:25:24 2004
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp	Thu Apr 21 18:40:47 2005
@@ -1,16 +1,16 @@
 //===-- EdgeCode.cpp - generate LLVM instrumentation code -----------------===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
-//It implements the class EdgeCode: which provides 
+//It implements the class EdgeCode: which provides
 //support for inserting "appropriate" instrumentation at
 //designated points in the graph
 //
-//It also has methods to insert initialization code in 
+//It also has methods to insert initialization code in
 //top block of cfg
 //===----------------------------------------------------------------------===//
 
@@ -29,8 +29,8 @@
 namespace llvm {
 
 static void getTriggerCode(Module *M, BasicBlock *BB, int MethNo, Value *pathNo,
-                           Value *cnt, Instruction *rInst){ 
-  
+                           Value *cnt, Instruction *rInst){
+
   vector<Value *> tmpVec;
   tmpVec.push_back(Constant::getNullValue(Type::LongTy));
   tmpVec.push_back(Constant::getNullValue(Type::LongTy));
@@ -38,7 +38,7 @@
   BB->getInstList().push_back(Idx);
 
   const Type *PIntTy = PointerType::get(Type::IntTy);
-  Function *trigMeth = M->getOrInsertFunction("trigger", Type::VoidTy, 
+  Function *trigMeth = M->getOrInsertFunction("trigger", Type::VoidTy,
                                               Type::IntTy, Type::IntTy,
                                               PIntTy, PIntTy, 0);
   assert(trigMeth && "trigger method could not be inserted!");
@@ -58,18 +58,18 @@
 
 //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, 
+void getEdgeCode::getCode(Instruction *rInst, Value *countInst,
+			  Function *M, BasicBlock *BB,
                           vector<Value *> &retVec){
-  
+
   //Instruction *InsertPos = BB->getInstList().begin();
-  
+
   //now check for cdIn and cdOut
   //first put cdOut
   if(cdOut!=NULL){
     cdOut->getCode(rInst, countInst, M, BB, retVec);
   }
-  
+
   if(cdIn!=NULL){
     cdIn->getCode(rInst, countInst, M, BB, retVec);
   }
@@ -93,7 +93,7 @@
 #endif
     break;
   }
-    
+
   //r+=k
   case 3:{
     Instruction *ldInst = new LoadInst(rInst, "ti1");//, InsertPos);
@@ -116,33 +116,33 @@
     tmpVec.push_back(ConstantSInt::get(Type::LongTy, inc));
     Instruction *Idx = new GetElementPtrInst(countInst, tmpVec, "");//,
 
-    //Instruction *Idx = new GetElementPtrInst(countInst, 
+    //Instruction *Idx = new GetElementPtrInst(countInst,
     //           vector<Value*>(1,ConstantSInt::get(Type::LongTy, inc)),
     //                                       "");//, InsertPos);
     BB->getInstList().push_back(Idx);
 
     Instruction *ldInst=new LoadInst(Idx, "ti1");//, InsertPos);
     BB->getInstList().push_back(ldInst);
- 
+
     Value *val = ConstantSInt::get(Type::IntTy, 1);
     //Instruction *addIn =
     Instruction *newCount =
       BinaryOperator::create(Instruction::Add, ldInst, val,"ti2");
     BB->getInstList().push_back(newCount);
-    
+
 
 #ifdef INSERT_STORE
     //Instruction *stInst=new StoreInst(addIn, Idx, InsertPos);
     Instruction *stInst=new StoreInst(newCount, Idx);//, InsertPos);
     BB->getInstList().push_back(stInst);
 #endif
-    
+
     Value *trAddIndex = ConstantSInt::get(Type::IntTy,inc);
 
     retVec.push_back(newCount);
     retVec.push_back(trAddIndex);
     //insert trigger
-    //getTriggerCode(M->getParent(), BB, MethNo, 
+    //getTriggerCode(M->getParent(), BB, MethNo,
     //	   ConstantSInt::get(Type::IntTy,inc), newCount, triggerInst);
     //end trigger code
 
@@ -152,7 +152,7 @@
 
   //case: count[r+inc]++
   case 5:{
-   
+
     //ti1=inc+r
     Instruction *ldIndex=new LoadInst(rInst, "ti1");//, InsertPos);
     BB->getInstList().push_back(ldIndex);
@@ -161,9 +161,9 @@
     Instruction *addIndex=BinaryOperator::
       create(Instruction::Add, ldIndex, val,"ti2");//, InsertPos);
     BB->getInstList().push_back(addIndex);
-    
+
     //now load count[addIndex]
-    Instruction *castInst=new CastInst(addIndex, 
+    Instruction *castInst=new CastInst(addIndex,
 				       Type::LongTy,"ctin");//, InsertPos);
     BB->getInstList().push_back(castInst);
 
@@ -180,10 +180,10 @@
     Value *cons=ConstantSInt::get(Type::IntTy,1);
     //count[addIndex]++
     //std::cerr<<"Type ldInst:"<<ldInst->getType()<<"\t cons:"<<cons->getType()<<"\n";
-    Instruction *newCount = BinaryOperator::create(Instruction::Add, ldInst, 
+    Instruction *newCount = BinaryOperator::create(Instruction::Add, ldInst,
                                                    cons,"");
     BB->getInstList().push_back(newCount);
-    
+
 #ifdef INSERT_STORE
     Instruction *stInst = new StoreInst(newCount, Idx);//, InsertPos);
     BB->getInstList().push_back(stInst);
@@ -213,11 +213,11 @@
     tmpVec.push_back(castInst2);
     Instruction *Idx = new GetElementPtrInst(countInst, tmpVec, "");//,
 
-    //Instruction *Idx = new GetElementPtrInst(countInst, 
+    //Instruction *Idx = new GetElementPtrInst(countInst,
     //                                       vector<Value*>(1,castInst2), "");
-    
+
     BB->getInstList().push_back(Idx);
-    
+
     Instruction *ldInst=new LoadInst(Idx, "ti2");//, InsertPos);
     BB->getInstList().push_back(ldInst);
 
@@ -237,7 +237,7 @@
     retVec.push_back(ldIndex);
     break;
   }
-    
+
   }
 }
 
@@ -245,25 +245,25 @@
 
 //Insert the initialization code in the top BB
 //this includes initializing r, and count
-//r is like an accumulator, that 
+//r is like an accumulator, that
 //keeps on adding increments as we traverse along a path
 //and at the end of the path, r contains the path
 //number of that path
 //Count is an array, where Count[k] represents
 //the number of executions of path k
-void insertInTopBB(BasicBlock *front, 
-		   int k, 
+void insertInTopBB(BasicBlock *front,
+		   int k,
 		   Instruction *rVar, Value *threshold){
-  //rVar is variable r, 
+  //rVar is variable r,
   //countVar is count[]
 
   Value *Int0 = ConstantInt::get(Type::IntTy, 0);
-  
+
   //now push all instructions in front of the BB
   BasicBlock::iterator here=front->begin();
   front->getInstList().insert(here, rVar);
   //front->getInstList().insert(here,countVar);
-  
+
   //Initialize Count[...] with 0
 
   //for (int i=0;i<k; i++){
@@ -281,22 +281,22 @@
 //insert a basic block with appropriate code
 //along a given edge
 void insertBB(Edge ed,
-	      getEdgeCode *edgeCode, 
-	      Instruction *rInst, 
-	      Value *countInst, 
+	      getEdgeCode *edgeCode,
+	      Instruction *rInst,
+	      Value *countInst,
 	      int numPaths, int Methno, Value *threshold){
 
   BasicBlock* BB1=ed.getFirst()->getElement();
   BasicBlock* BB2=ed.getSecond()->getElement();
-  
+
 #ifdef DEBUG_PATH_PROFILES
   //debugging info
   cerr<<"Edges with codes ######################\n";
   cerr<<BB1->getName()<<"->"<<BB2->getName()<<"\n";
   cerr<<"########################\n";
 #endif
-  
-  //We need to insert a BB between BB1 and BB2 
+
+  //We need to insert a BB between BB1 and BB2
   TerminatorInst *TI=BB1->getTerminator();
   BasicBlock *newBB=new BasicBlock("counter", BB1->getParent());
 
@@ -316,7 +316,7 @@
   else{
       if(BI->getSuccessor(0)==BB2)
       BI->setSuccessor(0, newBB);
-    
+
     if(BI->getSuccessor(1)==BB2)
       BI->setSuccessor(1, newBB);
   }
@@ -324,21 +324,21 @@
   BasicBlock *triggerBB = NULL;
   if(retVec.size()>0){
     triggerBB = new BasicBlock("trigger", BB1->getParent());
-    getTriggerCode(BB1->getParent()->getParent(), triggerBB, Methno, 
+    getTriggerCode(BB1->getParent()->getParent(), triggerBB, Methno,
                    retVec[1], countInst, rInst);//retVec[0]);
 
     //Instruction *castInst = new CastInst(retVec[0], Type::IntTy, "");
     Instruction *etr = new LoadInst(threshold, "threshold");
-    
-    //std::cerr<<"type1: "<<etr->getType()<<" type2: "<<retVec[0]->getType()<<"\n"; 
-    Instruction *cmpInst = new SetCondInst(Instruction::SetLE, etr, 
+
+    //std::cerr<<"type1: "<<etr->getType()<<" type2: "<<retVec[0]->getType()<<"\n";
+    Instruction *cmpInst = new SetCondInst(Instruction::SetLE, etr,
                                            retVec[0], "");
     Instruction *newBI2 = new BranchInst(triggerBB, BB2, cmpInst);
     //newBB->getInstList().push_back(castInst);
     newBB->getInstList().push_back(etr);
     newBB->getInstList().push_back(cmpInst);
     newBB->getInstList().push_back(newBI2);
-    
+
     //triggerBB->getInstList().push_back(triggerInst);
     new BranchInst(BB2, 0, 0, triggerBB);
   }
@@ -347,9 +347,9 @@
   }
 
   //now iterate over BB2, and set its Phi nodes right
-  for(BasicBlock::iterator BB2Inst = BB2->begin(), BBend = BB2->end(); 
+  for(BasicBlock::iterator BB2Inst = BB2->begin(), BBend = BB2->end();
       BB2Inst != BBend; ++BB2Inst){
-   
+
     if(PHINode *phiInst=dyn_cast<PHINode>(BB2Inst)){
       int bbIndex=phiInst->getBasicBlockIndex(BB1);
       assert(bbIndex>=0);


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp:1.19 llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp:1.20
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp:1.19	Wed Dec  8 10:12:20 2004
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp	Thu Apr 21 18:40:47 2005
@@ -1,10 +1,10 @@
 //===-- Graph.cpp - Implements Graph class --------------------------------===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This implements Graph for helping in trace generation This graph gets used by
@@ -23,7 +23,7 @@
 
 const graphListElement *findNodeInList(const Graph::nodeList &NL,
 					      Node *N) {
-  for(Graph::nodeList::const_iterator NI = NL.begin(), NE=NL.end(); NI != NE; 
+  for(Graph::nodeList::const_iterator NI = NL.begin(), NE=NL.end(); NI != NE;
       ++NI)
     if (*NI->element== *N)
       return &*NI;
@@ -38,7 +38,7 @@
 }
 
 //graph constructor with root and exit specified
-Graph::Graph(std::vector<Node*> n, std::vector<Edge> e, 
+Graph::Graph(std::vector<Node*> n, std::vector<Edge> e,
 	     Node *rt, Node *lt){
   strt=rt;
   ext=lt;
@@ -49,17 +49,17 @@
   for(vector<Edge >::iterator x=e.begin(), en=e.end(); x!=en; ++x){
     Edge ee=*x;
     int w=ee.getWeight();
-    //nodes[ee.getFirst()].push_front(graphListElement(ee.getSecond(),w, ee.getRandId()));   
+    //nodes[ee.getFirst()].push_front(graphListElement(ee.getSecond(),w, ee.getRandId()));
     nodes[ee.getFirst()].push_back(graphListElement(ee.getSecond(),w, ee.getRandId()));
   }
-  
+
 }
 
 //sorting edgelist, called by backEdgeVist ONLY!!!
 Graph::nodeList &Graph::sortNodeList(Node *par, nodeList &nl, vector<Edge> &be){
   assert(par && "null node pointer");
   BasicBlock *bbPar = par->getElement();
-  
+
   if(nl.size()<=1) return nl;
   if(getExit() == par) return nl;
 
@@ -79,7 +79,7 @@
 
         assert(ti && "not a branch");
         assert(ti->getNumSuccessors()==2 && "less successors!");
-        
+
         BasicBlock *tB = ti->getSuccessor(0);
         BasicBlock *fB = ti->getSuccessor(1);
         //so one of LI or min must be back edge!
@@ -109,24 +109,24 @@
           }
         }
       }
-      
+
       else if (min->element->getElement() != LI->element->getElement()){
         TerminatorInst *tti = par->getElement()->getTerminator();
         BranchInst *ti =  cast<BranchInst>(tti);
         assert(ti && "not a branch");
 
         if(ti->getNumSuccessors()<=1) continue;
-        
+
         assert(ti->getNumSuccessors()==2 && "less successors!");
-        
+
         BasicBlock *tB = ti->getSuccessor(0);
         BasicBlock *fB = ti->getSuccessor(1);
-        
+
         if(tB == LI->element->getElement() || fB == min->element->getElement())
           min = LI;
       }
     }
-    
+
     graphListElement tmpElmnt = *min;
     *min = *NLI;
     *NLI = tmpElmnt;
@@ -159,11 +159,11 @@
 
   Node *nd2=ed.getSecond();
   nodeList &nli = nodes[ed.getFirst()];//getNodeList(ed.getFirst());
-  
+
   for(nodeList::iterator NI=nli.begin(), NE=nli.end(); NI!=NE; ++NI)
     if(*NI->element == *nd2 && ed.getWeight()==NI->weight)
       return true;
-  
+
   return false;
 }
 
@@ -180,9 +180,9 @@
 }
 
 //add an edge
-//this adds an edge ONLY when 
+//this adds an edge ONLY when
 //the edge to be added does not already exist
-//we "equate" two edges here only with their 
+//we "equate" two edges here only with their
 //end points
 void Graph::addEdge(Edge ed, int w){
   nodeList &ndList = nodes[ed.getFirst()];
@@ -190,7 +190,7 @@
 
   if(findNodeInList(nodes[ed.getFirst()], nd2))
     return;
- 
+
   //ndList.push_front(graphListElement(nd2,w, ed.getRandId()));
   ndList.push_back(graphListElement(nd2,w, ed.getRandId()));//chng
   //sortNodeList(ed.getFirst(), ndList);
@@ -296,7 +296,7 @@
   for(nodeMapTy::const_iterator EI=nodes.begin(), EE=nodes.end(); EI!=EE ;++EI){
     Node *lnode=EI->first;
     const nodeList &nl = getNodeList(lnode);
-    for(Graph::nodeList::const_iterator NI = nl.begin(), NE=nl.end(); NI != NE; 
+    for(Graph::nodeList::const_iterator NI = nl.begin(), NE=nl.end(); NI != NE;
 	++NI)
       if (*NI->element== *nd)
 	count++;
@@ -340,19 +340,19 @@
 //of the graph
 Graph* Graph::getMaxSpanningTree(){
   //assume connected graph
- 
+
   Graph *st=new Graph();//max spanning tree, undirected edges
   int inf=9999999;//largest key
   vector<Node *> lt = getAllNodes();
-  
+
   //initially put all vertices in vector vt
   //assign wt(root)=0
   //wt(others)=infinity
   //
   //now:
   //pull out u: a vertex frm vt of min wt
-  //for all vertices w in vt, 
-  //if wt(w) greater than 
+  //for all vertices w in vt,
+  //if wt(w) greater than
   //the wt(u->w), then assign
   //wt(w) to be wt(u->w).
   //
@@ -360,7 +360,7 @@
   //keep pulling out vertices from vt till it is empty
 
   vector<Node *> vt;
-  
+
   std::map<Node*, Node* > parent;
   std::map<Node*, int > ed_weight;
 
@@ -373,7 +373,7 @@
       parent[thisNode]=NULL;
       ed_weight[thisNode]=0;
     }
-    else{ 
+    else{
       thisNode->setWeight(inf);
     }
     st->addNode(thisNode);//add all nodes to spanning tree
@@ -396,7 +396,7 @@
     }
 
     //vt.erase(u);
-    
+
     //remove u frm vt
     for(vector<Node *>::iterator VI=vt.begin(), VE=vt.end(); VI!=VE; ++VI){
       if(**VI==*u){
@@ -404,7 +404,7 @@
 	break;
       }
     }
-    
+
     //assign wt(v) to all adjacent vertices v of u
     //only if v is in vt
     Graph::nodeList &nl = getNodeList(u);
@@ -438,7 +438,7 @@
   return st;
 }
 
-//print the graph (for debugging)   
+//print the graph (for debugging)
 void Graph::printGraph(){
    vector<Node *> lt=getAllNodes();
    std::cerr<<"Graph---------------------\n";
@@ -469,7 +469,7 @@
 }
 
 //a private method for doing DFS traversal of graph
-//this is used in determining the reverse topological sort 
+//this is used in determining the reverse topological sort
 //of the graph
 void Graph::DFS_Visit(Node *nd, vector<Node *> &toReturn){
   nd->setWeight(GREY);
@@ -482,13 +482,13 @@
 }
 
 //Ordinarily, the graph is directional
-//this converts the graph into an 
+//this converts the graph into an
 //undirectional graph
 //This is done by adding an edge
 //v->u for all existing edges u->v
 void Graph::makeUnDirectional(){
   vector<Node* > allNodes=getAllNodes();
-  for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE; 
+  for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE;
       ++NI) {
     nodeList &nl = getNodeList(*NI);
     for(nodeList::iterator NLI=nl.begin(), NLE=nl.end(); NLI!=NLE; ++NLI){
@@ -507,10 +507,10 @@
 //using min-spanning tree, and vice versa
 void Graph::reverseWts(){
   vector<Node *> allNodes=getAllNodes();
-  for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE; 
+  for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE;
       ++NI) {
     nodeList &node_list = getNodeList(*NI);
-    for(nodeList::iterator NLI=nodes[*NI].begin(), NLE=nodes[*NI].end(); 
+    for(nodeList::iterator NLI=nodes[*NI].begin(), NLE=nodes[*NI].end();
 	NLI!=NLE; ++NLI)
       NLI->weight=-NLI->weight;
   }
@@ -535,7 +535,7 @@
   getBackEdgesVisit(getRoot(), be, color, d, time);
 }
 
-//helper function to get back edges: it is called by 
+//helper function to get back edges: it is called by
 //the "getBackEdges" function above
 void Graph::getBackEdgesVisit(Node *u, vector<Edge > &be,
 			      std::map<Node *, Color > &color,
@@ -545,14 +545,14 @@
   d[u]=time;
 
   vector<graphListElement> &succ_list = getNodeList(u);
-  
-  for(vector<graphListElement>::iterator vl=succ_list.begin(), 
+
+  for(vector<graphListElement>::iterator vl=succ_list.begin(),
 	ve=succ_list.end(); vl!=ve; ++vl){
     Node *v=vl->element;
     if(color[v]!=GREY && color[v]!=BLACK){
       getBackEdgesVisit(v, be, color, d, time);
     }
-    
+
     //now checking for d and f vals
     if(color[v]==GREY){
       //so v is ancestor of u if time of u > time of v


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.h
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.h:1.12 llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.h:1.13
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.h:1.12	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.h	Thu Apr 21 18:40:47 2005
@@ -1,10 +1,10 @@
 //===-- Graph.h -------------------------------------------------*- C++ -*-===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // Header file for Graph: This Graph is used by PathProfiles class, and is used
@@ -58,13 +58,13 @@
     randId=rand();
     isnull=false;
   }
-  
+
   inline Edge(Node *f,Node *s, int wt, double rd){
     first=f;
     second=s;
     weight=wt;
     randId=rd;
-    isnull=false; 
+    isnull=false;
   }
 
   inline Edge() { isnull = true; }
@@ -73,22 +73,22 @@
   inline Node* const getFirst() const { assert(!isNull()); return first; }
   inline Node* getSecond() { assert(!isNull()); return second; }
   inline Node* const getSecond() const { assert(!isNull()); return second; }
-  
+
   inline int getWeight() { assert(!isNull());  return weight; }
   inline void setWeight(int n) { assert(!isNull()); weight=n; }
-  
+
   inline void setFirst(Node *&f) { assert(!isNull());  first=f; }
   inline void setSecond(Node *&s) { assert(!isNull()); second=s; }
-  
-  
-  inline bool isNull() const { return isnull;} 
-  
+
+
+  inline bool isNull() const { return isnull;}
+
   inline bool operator<(const Edge& ed) const{
     // Can't be the same if one is null and the other isn't
     if (isNull() != ed.isNull())
       return true;
 
-    return (*first<*(ed.getFirst()))|| 
+    return (*first<*(ed.getFirst()))||
       (*first==*(ed.getFirst()) && *second<*(ed.getSecond()));
   }
 
@@ -96,19 +96,19 @@
     return !(*this<ed) && !(ed<*this);
   }
 
-  inline bool operator!=(const Edge& ed) const{return !(*this==ed);} 
+  inline bool operator!=(const Edge& ed) const{return !(*this==ed);}
 };
 
 
 //graphListElement
-//This forms the "adjacency list element" of a 
+//This forms the "adjacency list element" of a
 //vertex adjacency list in graph
 struct graphListElement{
   Node *element;
   int weight;
   double randId;
-  inline graphListElement(Node *n, int w, double rand){ 
-    element=n; 
+  inline graphListElement(Node *n, int w, double rand){
+    element=n;
     weight=w;
     randId=rand;
   }
@@ -127,12 +127,12 @@
       return n1->getElement() < n2->getElement();
     }
   };
- 
+
   template<>
   struct less<Edge> : public binary_function<Edge,Edge,bool> {
     bool operator()(Edge e1, Edge e2) const {
       assert(!e1.isNull() && !e2.isNull());
-      
+
       Node *x1=e1.getFirst();
       Node *x2=e1.getSecond();
       Node *y1=e2.getFirst();
@@ -210,7 +210,7 @@
 private:
   //the adjacency list of a vertex or node
   nodeMapTy nodes;
-  
+
   //the start or root node
   Node *strt;
 
@@ -218,7 +218,7 @@
   Node *ext;
 
   //a private method for doing DFS traversal of graph
-  //this is used in determining the reverse topological sort 
+  //this is used in determining the reverse topological sort
   //of the graph
   void DFS_Visit(Node *nd, std::vector<Node *> &toReturn);
 
@@ -232,10 +232,10 @@
   //have been visited
   //So we have a back edge when we meet a successor of
   //a node with smaller time, and GREY color
-  void getBackEdgesVisit(Node *u, 
+  void getBackEdgesVisit(Node *u,
 			 std::vector<Edge > &be,
 			 std::map<Node *, Color> &clr,
-			 std::map<Node *, int> &d, 
+			 std::map<Node *, int> &d,
 			 int &time);
 
 public:
@@ -248,18 +248,18 @@
 
   //empty constructor: then add edges and nodes later on
   Graph() {}
-  
+
   //constructor with root and exit node specified
-  Graph(std::vector<Node*> n, 
+  Graph(std::vector<Node*> n,
 	std::vector<Edge> e, Node *rt, Node *lt);
 
   //add a node
   void addNode(Node *nd);
 
   //add an edge
-  //this adds an edge ONLY when 
+  //this adds an edge ONLY when
   //the edge to be added doesn not already exist
-  //we "equate" two edges here only with their 
+  //we "equate" two edges here only with their
   //end points
   void addEdge(Edge ed, int w);
 
@@ -310,14 +310,14 @@
   //in r-topological sorted order
   //note that we assumed graph to be connected
   std::vector<Node *> reverseTopologicalSort();
-  
+
   //reverse the sign of weights on edges
   //this way, max-spanning tree could be obtained
   //usin min-spanning tree, and vice versa
   void reverseWts();
 
   //Ordinarily, the graph is directional
-  //this converts the graph into an 
+  //this converts the graph into an
   //undirectional graph
   //This is done by adding an edge
   //v->u for all existing edges u->v
@@ -325,31 +325,31 @@
 
   //print graph: for debugging
   void printGraph();
-  
+
   //get a vector of back edges in the graph
   void getBackEdges(std::vector<Edge> &be, std::map<Node *, int> &d);
 
   nodeList &sortNodeList(Node *par, nodeList &nl, std::vector<Edge> &be);
- 
+
   //Get the Maximal spanning tree (also a graph)
   //of the graph
   Graph* getMaxSpanningTree();
-  
+
   //get the nodeList adjacent to a node
-  //a nodeList element contains a node, and the weight 
+  //a nodeList element contains a node, and the weight
   //corresponding to the edge for that element
   inline nodeList &getNodeList(Node *nd) {
     elementIterator nli = nodes.find(nd);
     assert(nli != nodes.end() && "Node must be in nodes map");
     return nodes[nd];//sortNodeList(nd, nli->second);
   }
-   
+
   nodeList &getSortedNodeList(Node *nd, std::vector<Edge> &be) {
     elementIterator nli = nodes.find(nd);
     assert(nli != nodes.end() && "Node must be in nodes map");
     return sortNodeList(nd, nodes[nd], be);
   }
- 
+
   //get the root of the graph
   inline Node *getRoot()                {return strt; }
   inline Node * const getRoot() const   {return strt; }
@@ -365,7 +365,7 @@
   inline bool isLeaf(Node *n)    const  {return (*n==*ext);  }
 };
 
-//This class is used to generate 
+//This class is used to generate
 //"appropriate" code to be inserted
 //along an edge
 //The code to be inserted can be of six different types
@@ -378,13 +378,13 @@
 //6: Count[r]++
 class getEdgeCode{
  private:
-  //cond implies which 
+  //cond implies which
   //"kind" of code is to be inserted
   //(from 1-6 above)
   int cond;
   //inc is the increment: eg k, or 0
   int inc;
-  
+
   //A backedge must carry the code
   //of both incoming "dummy" edge
   //and outgoing "dummy" edge
@@ -420,23 +420,23 @@
 
   //set CdIn (only used for backedges)
   inline void setCdIn(getEdgeCode *gd){ cdIn=gd;}
-  
+
   //set CdOut (only used for backedges)
   inline void setCdOut(getEdgeCode *gd){ cdOut=gd;}
 
   //get the code to be inserted on the edge
   //This is determined from cond (1-6)
-  void getCode(Instruction *a, Value *b, Function *M, BasicBlock *BB, 
+  void getCode(Instruction *a, Value *b, Function *M, BasicBlock *BB,
                std::vector<Value *> &retVec);
 };
 
 
 //auxillary functions on graph
 
-//print a given edge in the form BB1Label->BB2Label 
+//print a given edge in the form BB1Label->BB2Label
 void printEdge(Edge ed);
 
-//Do graph processing: to determine minimal edge increments, 
+//Do graph processing: to determine minimal edge increments,
 //appropriate code insertions etc and insert the code at
 //appropriate locations
 void processGraph(Graph &g, Instruction *rInst, Value *countInst, std::vector<Edge> &be, std::vector<Edge> &stDummy, std::vector<Edge> &exDummy, int n, int MethNo, Value *threshold);
@@ -452,7 +452,7 @@
 
 //Insert the initialization code in the top BB
 //this includes initializing r, and count
-//r is like an accumulator, that 
+//r is like an accumulator, that
 //keeps on adding increments as we traverse along a path
 //and at the end of the path, r contains the path
 //number of that path
@@ -470,7 +470,7 @@
 //such that if we traverse along any path from root to exit, and
 //add up the edge values, we get a path number that uniquely
 //refers to the path we travelled
-int valueAssignmentToEdges(Graph& g, std::map<Node *, int> nodePriority, 
+int valueAssignmentToEdges(Graph& g, std::map<Node *, int> nodePriority,
                            std::vector<Edge> &be);
 
 void getBBtrace(std::vector<BasicBlock *> &vBB, int pathNo, Function *M);


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp:1.26 llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp:1.27
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp:1.26	Mon Oct 18 09:38:39 2004
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp	Thu Apr 21 18:40:47 2005
@@ -1,10 +1,10 @@
 //===- GraphAuxiliary.cpp - Auxiliary functions on graph ------------------===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // auxiliary function associated with graph: they all operate on graph, and help
@@ -36,10 +36,10 @@
   //make sure the spanning tree is directional
   //iterate over ALL the edges of the graph
   vector<Node *> allNodes=g.getAllNodes();
-  for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE; 
+  for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE;
       ++NI){
     Graph::nodeList node_list=g.getNodeList(*NI);
-    for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end(); 
+    for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end();
 	NLI!=NLE; ++NLI){
       Edge f(*NI, NLI->element,NLI->weight, NLI->randId);
       if(!(st.hasEdgeAndWt(f)))//addnl
@@ -51,13 +51,13 @@
 //Given a tree t, and a "directed graph" g
 //replace the edges in the tree t with edges that exist in graph
 //The tree is formed from "undirectional" copy of graph
-//So whatever edges the tree has, the undirectional graph 
-//would have too. This function corrects some of the directions in 
+//So whatever edges the tree has, the undirectional graph
+//would have too. This function corrects some of the directions in
 //the tree so that now, all edge directions in the tree match
 //the edge directions of corresponding edges in the directed graph
 static void removeTreeEdges(Graph &g, Graph& t){
   vector<Node* > allNodes=t.getAllNodes();
-  for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE; 
+  for(vector<Node *>::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){
@@ -72,11 +72,11 @@
 //such that if we traverse along any path from root to exit, and
 //add up the edge values, we get a path number that uniquely
 //refers to the path we travelled
-int valueAssignmentToEdges(Graph& g,  map<Node *, int> nodePriority, 
+int valueAssignmentToEdges(Graph& g,  map<Node *, int> nodePriority,
                            vector<Edge> &be){
   vector<Node *> revtop=g.reverseTopologicalSort();
   map<Node *,int > NumPaths;
-  for(vector<Node *>::iterator RI=revtop.begin(), RE=revtop.end(); 
+  for(vector<Node *>::iterator RI=revtop.begin(), RE=revtop.end();
       RI!=RE; ++RI){
     if(g.isLeaf(*RI))
       NumPaths[*RI]=1;
@@ -87,47 +87,47 @@
       Graph::nodeList &nlist=g.getSortedNodeList(*RI, be);
 
       //sort nodelist by increasing order of numpaths
-      
+
       int sz=nlist.size();
-      
+
       for(int i=0;i<sz-1; i++){
 	int min=i;
 	for(int j=i+1; j<sz; j++){
           BasicBlock *bb1 = nlist[j].element->getElement();
           BasicBlock *bb2 = nlist[min].element->getElement();
-          
+
           if(bb1 == bb2) continue;
-          
+
           if(*RI == g.getRoot()){
-            assert(nodePriority[nlist[min].element]!= 
-                   nodePriority[nlist[j].element] 
+            assert(nodePriority[nlist[min].element]!=
+                   nodePriority[nlist[j].element]
                    && "priorities can't be same!");
-            
-            if(nodePriority[nlist[j].element] < 
+
+            if(nodePriority[nlist[j].element] <
                nodePriority[nlist[min].element])
-              min = j; 
+              min = j;
           }
 
           else{
             TerminatorInst *tti = (*RI)->getElement()->getTerminator();
-            
+
             BranchInst *ti =  cast<BranchInst>(tti);
             assert(ti && "not a branch");
             assert(ti->getNumSuccessors()==2 && "less successors!");
-            
+
             BasicBlock *tB = ti->getSuccessor(0);
             BasicBlock *fB = ti->getSuccessor(1);
-            
+
             if(tB == bb1 || fB == bb2)
               min = j;
           }
-          
+
         }
 	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){
@@ -148,35 +148,35 @@
 //refers to the path we travelled
 //inc_Dir tells whether 2 edges are in same, or in different directions
 //if same direction, return 1, else -1
-static int inc_Dir(Edge e, Edge f){ 
- if(e.isNull()) 
+static int inc_Dir(Edge e, Edge f){
+ if(e.isNull())
     return 1;
- 
+
  //check that the edges must have at least one common endpoint
   assert(*(e.getFirst())==*(f.getFirst()) ||
-	 *(e.getFirst())==*(f.getSecond()) || 
+	 *(e.getFirst())==*(f.getSecond()) ||
 	 *(e.getSecond())==*(f.getFirst()) ||
 	 *(e.getSecond())==*(f.getSecond()));
 
-  if(*(e.getFirst())==*(f.getSecond()) || 
+  if(*(e.getFirst())==*(f.getSecond()) ||
      *(e.getSecond())==*(f.getFirst()))
     return 1;
-  
+
   return -1;
 }
 
 
 //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<Edge, int, EdgeCompare2>& Increment, 
+//inc_DFS is a modification of DFS
+static void inc_DFS(Graph& g,Graph& t,map<Edge, int, EdgeCompare2>& Increment,
 	     int events, Node *v, Edge e){
-  
+
   vector<Node *> allNodes=t.getAllNodes();
 
-  for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE; 
+  for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE;
       ++NI){
     Graph::nodeList node_list=t.getNodeList(*NI);
-    for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end(); 
+    for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end();
 	NLI!= NLE; ++NLI){
       Edge f(*NI, NLI->element,NLI->weight, NLI->randId);
       if(!edgesEqual(f,e) && *v==*(f.getSecond())){
@@ -187,29 +187,29 @@
     }
   }
 
-  for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE; 
+  for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE;
       ++NI){
     Graph::nodeList node_list=t.getNodeList(*NI);
-    for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end(); 
+    for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end();
 	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, 
+	inc_DFS(g,t, Increment, dir_count*events+wt,
 		f.getSecond(), f);
       }
     }
   }
 
   allNodes=g.getAllNodes();
-  for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE; 
+  for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE;
       ++NI){
     Graph::nodeList node_list=g.getNodeList(*NI);
-    for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end(); 
+    for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end();
 	NLI!=NLE; ++NLI){
       Edge f(*NI, NLI->element,NLI->weight, NLI->randId);
-      if(!(t.hasEdgeAndWt(f)) && (*v==*(f.getSecond()) || 
+      if(!(t.hasEdgeAndWt(f)) && (*v==*(f.getSecond()) ||
 				  *v==*(f.getFirst()))){
 	int dir_count=inc_Dir(e,f);
 	Increment[f]+=dir_count*events;
@@ -219,21 +219,21 @@
 }
 
 //Now we select a subset of all edges
-//and assign them some values such that 
+//and assign them some values such that
 //if we consider just this subset, it still represents
 //the path sum along any path in the graph
-static map<Edge, int, EdgeCompare2> getEdgeIncrements(Graph& g, Graph& t, 
+static map<Edge, int, EdgeCompare2> getEdgeIncrements(Graph& g, Graph& t,
                                                       vector<Edge> &be){
   //get all edges in g-t
   map<Edge, int, EdgeCompare2> Increment;
 
   vector<Node *> allNodes=g.getAllNodes();
- 
-  for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE; 
+
+  for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE;
       ++NI){
     Graph::nodeList node_list=g.getSortedNodeList(*NI, be);
     //modified g.getNodeList(*NI);
-    for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end(); 
+    for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end();
 	NLI!=NLE; ++NLI){
       Edge ed(*NI, NLI->element,NLI->weight,NLI->randId);
       if(!(t.hasEdgeAndWt(ed))){
@@ -245,11 +245,11 @@
   Edge *ed=new Edge();
   inc_DFS(g,t,Increment, 0, g.getRoot(), *ed);
 
-  for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE; 
+  for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE;
       ++NI){
     Graph::nodeList node_list=g.getSortedNodeList(*NI, be);
     //modified g.getNodeList(*NI);
-    for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end(); 
+    for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end();
 	NLI!=NLE; ++NLI){
       Edge ed(*NI, NLI->element,NLI->weight, NLI->randId);
       if(!(t.hasEdgeAndWt(ed))){
@@ -274,7 +274,7 @@
 //The idea here is to minimize the computation
 //by inserting only the needed code
 static void getCodeInsertions(Graph &g, map<Edge, getEdgeCode *, EdgeCompare2> &instr,
-                              vector<Edge > &chords, 
+                              vector<Edge > &chords,
                               map<Edge,int, EdgeCompare2> &edIncrements){
 
   //Register initialization code
@@ -285,7 +285,7 @@
     ws.pop_back();
     //for each edge v->w
     Graph::nodeList succs=g.getNodeList(v);
-    
+
     for(Graph::nodeList::iterator nl=succs.begin(), ne=succs.end();
 	nl!=ne; ++nl){
       int edgeWt=nl->weight;
@@ -320,7 +320,7 @@
 
   /////Memory increment code
   ws.push_back(g.getExit());
-  
+
   while(!ws.empty()) {
     Node *w=ws.back();
     ws.pop_back();
@@ -333,11 +333,11 @@
       Node *lnode=*EII;
       Graph::nodeList &nl = g.getNodeList(lnode);
       //graphListElement *N = findNodeInList(nl, w);
-      for(Graph::nodeList::const_iterator N = nl.begin(), 
+      for(Graph::nodeList::const_iterator N = nl.begin(),
             NNEN = nl.end(); N!= NNEN; ++N){
         if (*N->element == *w){	
           Node *v=lnode;
-          
+
           //if chords has v->w
           Edge ed(v,w, N->weight, N->randId);
           getEdgeCode *edCd=new getEdgeCode();
@@ -359,7 +359,7 @@
               edCd->setInc(edIncrements[ed]);
               instr[ed]=edCd;
             }
-            
+
           }
           else if(g.getNumberOfOutgoingEdges(v)==1)
             ws.push_back(v);
@@ -387,8 +387,8 @@
 //then incoming dummy edge is root->b
 //and outgoing dummy edge is a->exit
 //changed
-void addDummyEdges(vector<Edge > &stDummy, 
-		   vector<Edge > &exDummy, 
+void addDummyEdges(vector<Edge > &stDummy,
+		   vector<Edge > &exDummy,
 		   Graph &g, vector<Edge> &be){
   for(vector<Edge >::iterator VI=be.begin(), VE=be.end(); VI!=VE; ++VI){
     Edge ed=*VI;
@@ -420,17 +420,17 @@
 
 //Move the incoming dummy edge code and outgoing dummy
 //edge code over to the corresponding back edge
-static void moveDummyCode(vector<Edge> &stDummy, 
-                          vector<Edge> &exDummy, 
-                          vector<Edge> &be,  
-                          map<Edge, getEdgeCode *, EdgeCompare2> &insertions, 
+static void moveDummyCode(vector<Edge> &stDummy,
+                          vector<Edge> &exDummy,
+                          vector<Edge> &be,
+                          map<Edge, getEdgeCode *, EdgeCompare2> &insertions,
 			  Graph &g){
   typedef vector<Edge >::iterator vec_iter;
-  
+
   map<Edge,getEdgeCode *, EdgeCompare2> temp;
   //iterate over edges with code
   std::vector<Edge> toErase;
-  for(map<Edge,getEdgeCode *, EdgeCompare2>::iterator MI=insertions.begin(), 
+  for(map<Edge,getEdgeCode *, EdgeCompare2>::iterator MI=insertions.begin(),
 	ME=insertions.end(); MI!=ME; ++MI){
     Edge ed=MI->first;
     getEdgeCode *edCd=MI->second;
@@ -462,18 +462,18 @@
       }
     }
   }
-  
-  for(vector<Edge >::iterator vmi=toErase.begin(), vme=toErase.end(); vmi!=vme; 
+
+  for(vector<Edge >::iterator vmi=toErase.begin(), vme=toErase.end(); vmi!=vme;
       ++vmi){
     insertions.erase(*vmi);
     g.removeEdgeWithWt(*vmi);
   }
-  
-  for(map<Edge,getEdgeCode *, EdgeCompare2>::iterator MI=temp.begin(), 
+
+  for(map<Edge,getEdgeCode *, EdgeCompare2>::iterator MI=temp.begin(),
       ME=temp.end(); MI!=ME; ++MI){
     insertions[MI->first]=MI->second;
   }
-    
+
 #ifdef DEBUG_PATH_PROFILES
   cerr<<"size of deletions: "<<toErase.size()<<"\n";
   cerr<<"SIZE OF INSERTIONS AFTER DEL "<<insertions.size()<<"\n";
@@ -481,16 +481,16 @@
 
 }
 
-//Do graph processing: to determine minimal edge increments, 
+//Do graph processing: to determine minimal edge increments,
 //appropriate code insertions etc and insert the code at
 //appropriate locations
-void processGraph(Graph &g, 
-		  Instruction *rInst, 
-		  Value *countInst, 
-		  vector<Edge >& be, 
-		  vector<Edge >& stDummy, 
-		  vector<Edge >& exDummy, 
-		  int numPaths, int MethNo, 
+void processGraph(Graph &g,
+		  Instruction *rInst,
+		  Value *countInst,
+		  vector<Edge >& be,
+		  vector<Edge >& stDummy,
+		  vector<Edge >& exDummy,
+		  int numPaths, int MethNo,
                   Value *threshold){
 
   //Given a graph: with exit->root edge, do the following in seq:
@@ -505,11 +505,11 @@
   //5. Get edge increments
   //6. Get code insertions
   //7. move code on dummy edges over to the back edges
-  
 
-  //This is used as maximum "weight" for 
+
+  //This is used as maximum "weight" for
   //priority queue
-  //This would hold all 
+  //This would hold all
   //right as long as number of paths in the graph
   //is less than this
   const int Infinity=99999999;
@@ -524,7 +524,7 @@
   //if its there earlier, remove it!
   //assign it weight Infinity
   //so that this edge IS ALWAYS IN spanning tree
-  //Note than edges in spanning tree do not get 
+  //Note than edges in spanning tree do not get
   //instrumented: and we do not want the
   //edge exit->root to get instrumented
   //as it MAY BE a dummy edge
@@ -544,13 +544,13 @@
 #endif
   //now edges of tree t have weights reversed
   //(negative) because the algorithm used
-  //to find max spanning tree is 
+  //to find max spanning tree is
   //actually for finding min spanning tree
   //so get back the original weights
   t->reverseWts();
 
   //Ordinarily, the graph is directional
-  //lets converts the graph into an 
+  //lets converts the graph into an
   //undirectional graph
   //This is done by adding an edge
   //v->u for all existing edges u->v
@@ -559,8 +559,8 @@
   //Given a tree t, and a "directed graph" g
   //replace the edges in the tree t with edges that exist in graph
   //The tree is formed from "undirectional" copy of graph
-  //So whatever edges the tree has, the undirectional graph 
-  //would have too. This function corrects some of the directions in 
+  //So whatever edges the tree has, the undirectional graph
+  //would have too. This function corrects some of the directions in
   //the tree so that now, all edge directions in the tree match
   //the edge directions of corresponding edges in the directed graph
   removeTreeEdges(g, *t);
@@ -588,7 +588,7 @@
   //step 5: Get edge increments
 
   //Now we select a subset of all edges
-  //and assign them some values such that 
+  //and assign them some values such that
   //if we consider just this subset, it still represents
   //the path sum along any path in the graph
 
@@ -603,9 +603,9 @@
   std::cerr<<"-------end of edge increments\n";
 #endif
 
- 
+
   //step 6: Get code insertions
-  
+
   //Based on edgeIncrements (above), now obtain
   //the kind of code to be inserted along an edge
   //The idea here is to minimize the computation
@@ -616,11 +616,11 @@
 
   map<Edge, getEdgeCode *, EdgeCompare2> codeInsertions;
   getCodeInsertions(g, codeInsertions, chords,increment);
-  
+
 #ifdef DEBUG_PATH_PROFILES
   //print edges with code for debugging
   cerr<<"Code inserted in following---------------\n";
-  for(map<Edge, getEdgeCode *, EdgeCompare2>::iterator cd_i=codeInsertions.begin(), 
+  for(map<Edge, getEdgeCode *, EdgeCompare2>::iterator cd_i=codeInsertions.begin(),
 	cd_e=codeInsertions.end(); cd_i!=cd_e; ++cd_i){
     printEdge(cd_i->first);
     cerr<<cd_i->second->getCond()<<":"<<cd_i->second->getInc()<<"\n";
@@ -634,11 +634,11 @@
   //edge code over to the corresponding back edge
 
   moveDummyCode(stDummy, exDummy, be, codeInsertions, g);
-  
+
 #ifdef DEBUG_PATH_PROFILES
   //debugging info
   cerr<<"After moving dummy code\n";
-  for(map<Edge, getEdgeCode *,EdgeCompare2>::iterator cd_i=codeInsertions.begin(), 
+  for(map<Edge, getEdgeCode *,EdgeCompare2>::iterator cd_i=codeInsertions.begin(),
 	cd_e=codeInsertions.end(); cd_i != cd_e; ++cd_i){
     printEdge(cd_i->first);
     cerr<<cd_i->second->getCond()<<":"
@@ -650,22 +650,22 @@
 
   //see what it looks like...
   //now insert code along edges which have codes on them
-  for(map<Edge, getEdgeCode *,EdgeCompare2>::iterator MI=codeInsertions.begin(), 
+  for(map<Edge, getEdgeCode *,EdgeCompare2>::iterator MI=codeInsertions.begin(),
 	ME=codeInsertions.end(); MI!=ME; ++MI){
     Edge ed=MI->first;
     insertBB(ed, MI->second, rInst, countInst, numPaths, MethNo, threshold);
-  } 
+  }
 }
 
 //print the graph (for debugging)
 void printGraph(Graph &g){
   vector<Node *> lt=g.getAllNodes();
   cerr<<"Graph---------------------\n";
-  for(vector<Node *>::iterator LI=lt.begin(); 
+  for(vector<Node *>::iterator LI=lt.begin();
       LI!=lt.end(); ++LI){
     cerr<<((*LI)->getElement())->getName()<<"->";
     Graph::nodeList nl=g.getNodeList(*LI);
-    for(Graph::nodeList::iterator NI=nl.begin(); 
+    for(Graph::nodeList::iterator NI=nl.begin();
 	NI!=nl.end(); ++NI){
       cerr<<":"<<"("<<(NI->element->getElement())
 	->getName()<<":"<<NI->element->getWeight()<<","<<NI->weight<<","


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.19 llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.20
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.19	Thu Jan  6 23:42:13 2005
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp	Thu Apr 21 18:40:47 2005
@@ -1,10 +1,10 @@
 //===-- InstLoops.cpp -----------------------------------------------------===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This is the first-level instrumentation pass for the Reoptimizer. It
@@ -46,7 +46,7 @@
     DominatorSet *DS;
     void getBackEdgesVisit(BasicBlock *u,
 			   std::map<BasicBlock *, Color > &color,
-			   std::map<BasicBlock *, int > &d, 
+			   std::map<BasicBlock *, int > &d,
 			   int &time, BBMap &be);
     void removeRedundant(BBMap &be);
     void findAndInstrumentBackEdges(Function &F);
@@ -54,15 +54,15 @@
     bool doInitialization(Module &M);
     bool runOnFunction(Function &F);
   };
-  
+
   RegisterOpt<InstLoops> X("instloops", "Instrument backedges for profiling");
 }
 
-//helper function to get back edges: it is called by 
+//helper function to get back edges: it is called by
 //the "getBackEdges" function below
 void InstLoops::getBackEdgesVisit(BasicBlock *u,
                        std::map<BasicBlock *, Color > &color,
-                       std::map<BasicBlock *, int > &d, 
+                       std::map<BasicBlock *, int > &d,
                        int &time, BBMap &be) {
   color[u]=GREY;
   time++;
@@ -74,7 +74,7 @@
     if(color[BB]!=GREY && color[BB]!=BLACK){
       getBackEdgesVisit(BB, color, d, time, be);
     }
-    
+
     //now checking for d and f vals
     else if(color[BB]==GREY){
       //so v is ancestor of u if time of u > time of v
@@ -91,13 +91,13 @@
 //set
 void InstLoops::removeRedundant(BBMap &be) {
   std::vector<BasicBlock *> toDelete;
-  for(std::map<BasicBlock *, BasicBlock *>::iterator MI = be.begin(), 
+  for(std::map<BasicBlock *, BasicBlock *>::iterator MI = be.begin(),
 	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);
   // Remove all the back-edges we found from be.
-  for(std::vector<BasicBlock *>::iterator VI = toDelete.begin(), 
+  for(std::vector<BasicBlock *>::iterator VI = toDelete.begin(),
 	VE = toDelete.end(); VI != VE; ++VI)
     be.erase(*VI);
 }
@@ -137,14 +137,14 @@
 
     assert(ti->getNumSuccessors() > index && "Not enough successors!");
     ti->setSuccessor(index, newBB);
-        
+
     BasicBlock::InstListType &lt = newBB->getInstList();
     lt.push_back(new CallInst(inCountMth));
     new BranchInst(BB, newBB);
-      
+
     // Now, set the sources of Phi nodes corresponding to the back-edge
     // in BB to come from the instrumentation block instead.
-    for(BasicBlock::iterator BB2Inst = BB->begin(), BBend = BB->end(); 
+    for(BasicBlock::iterator BB2Inst = BB->begin(), BBend = BB->end();
         BB2Inst != BBend; ++BB2Inst) {
       if (PHINode *phiInst = dyn_cast<PHINode>(BB2Inst)) {
         int bbIndex = phiInst->getBasicBlockIndex(u);


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.42 llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.43
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.42	Fri Jan  7 00:57:28 2005
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp	Thu Apr 21 18:40:47 2005
@@ -1,17 +1,17 @@
 //===-- ProfilePaths.cpp - interface to insert instrumentation --*- C++ -*-===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This inserts instrumentation for counting execution of paths though a given
 // function Its implemented as a "Function" Pass, and called using opt
 //
-// This pass is implemented by using algorithms similar to 
-// 1."Efficient Path Profiling": Ball, T. and Larus, J. R., 
+// This pass is implemented by using algorithms similar to
+// 1."Efficient Path Profiling": Ball, T. and Larus, J. R.,
 //    Proceedings of Micro-29, Dec 1996, Paris, France.
 // 2."Efficiently Counting Program events with support for on-line
 //   "queries": Ball T., ACM Transactions on Programming Languages
@@ -22,7 +22,7 @@
 // (implementation in Graph.cpp and GraphAuxiliary.cpp) and finally, appropriate
 // instrumentation is placed over suitable edges.  (code inserted through
 // EdgeCode.cpp).
-// 
+//
 // The algorithm inserts code such that every acyclic path in the CFG of a
 // function is identified through a unique number. the code insertion is optimal
 // in the sense that its inserted over a minimal set of edges. Also, the
@@ -47,7 +47,7 @@
 struct ProfilePaths : public FunctionPass {
   bool runOnFunction(Function &F);
 
-  // Before this pass, make sure that there is only one 
+  // Before this pass, make sure that there is only one
   // entry and only one exit node for the function in the CFG of the function
   //
   void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -76,13 +76,13 @@
   if(F.isExternal()) {
     return false;
   }
- 
+
   //increment counter for instrumented functions. mn is now function#
   mn++;
-  
+
   // Transform the cfg s.t. we have just one exit node
-  BasicBlock *ExitNode = 
-    getAnalysis<UnifyFunctionExitNodes>().getReturnBlock();  
+  BasicBlock *ExitNode =
+    getAnalysis<UnifyFunctionExitNodes>().getReturnBlock();
 
   //iterating over BBs and making graph
   std::vector<Node *> nodes;
@@ -92,10 +92,10 @@
 
   // The nodes must be uniquely identified:
   // That is, no two nodes must hav same BB*
-  
+
   for (Function::iterator BB = F.begin(), BE = F.end(); BB != BE; ++BB) {
     Node *nd=new Node(BB);
-    nodes.push_back(nd); 
+    nodes.push_back(nd);
     if(&*BB == ExitNode)
       exitNode=nd;
     if(BB==F.begin())
@@ -114,22 +114,22 @@
       edges.push_back(ed);
     }
   }
-  
+
   Graph g(nodes,edges, startNode, exitNode);
 
-#ifdef DEBUG_PATH_PROFILES  
+#ifdef DEBUG_PATH_PROFILES
   std::cerr<<"Original graph\n";
   printGraph(g);
 #endif
 
   BasicBlock *fr = &F.front();
-  
+
   // The graph is made acyclic: this is done
   // by removing back edges for now, and adding them later on
   std::vector<Edge> be;
   std::map<Node *, int> nodePriority; //it ranks nodes in depth first order traversal
   g.getBackEdges(be, nodePriority);
-  
+
 #ifdef DEBUG_PATH_PROFILES
   std::cerr<<"BackEdges-------------\n";
   for (std::vector<Edge>::iterator VI=be.begin(); VI!=be.end(); ++VI){
@@ -190,7 +190,7 @@
     Function *initialize =
       F.getParent()->getOrInsertFunction("reoptimizerInitialize", Type::VoidTy,
                                          PointerType::get(Type::IntTy), 0);
-    
+
     std::vector<Value *> trargs;
     trargs.push_back(threshold);
     new CallInst(initialize, trargs, "", fr->begin());
@@ -198,8 +198,8 @@
 
 
   if(numPaths<=1 || numPaths >5000) return false;
-  
-#ifdef DEBUG_PATH_PROFILES  
+
+#ifdef DEBUG_PATH_PROFILES
   printGraph(g);
 #endif
 
@@ -210,12 +210,12 @@
   //count is an array: count[x] would store
   //the number of executions of path numbered x
 
-  Instruction *rVar=new 
-    AllocaInst(Type::IntTy, 
+  Instruction *rVar=new
+    AllocaInst(Type::IntTy,
                ConstantUInt::get(Type::UIntTy,1),"R");
 
-  //Instruction *countVar=new 
-  //AllocaInst(Type::IntTy, 
+  //Instruction *countVar=new
+  //AllocaInst(Type::IntTy,
   //           ConstantUInt::get(Type::UIntTy, numPaths), "Count");
 
   //initialize counter array!
@@ -230,21 +230,21 @@
   CountCounter++;
   std::string countStr = tempChar;
   GlobalVariable *countVar = new GlobalVariable(ATy, false,
-                                                GlobalValue::InternalLinkage, 
+                                                GlobalValue::InternalLinkage,
                                                 initializer, countStr,
                                                 F.getParent());
-  
+
   // insert initialization code in first (entry) BB
   // this includes initializing r and count
   insertInTopBB(&F.getEntryBlock(), numPaths, rVar, threshold);
-    
+
   //now process the graph: get path numbers,
   //get increments along different paths,
   //and assign "increments" and "updates" (to r and count)
   //"optimally". Finally, insert llvm code along various edges
-  processGraph(g, rVar, countVar, be, stDummy, exDummy, numPaths, mn, 
-               threshold);    
-   
+  processGraph(g, rVar, countVar, be, stDummy, exDummy, numPaths, mn,
+               threshold);
+
   return true;  // Always modifies function
 }
 


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp:1.11 llvm/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp:1.12
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp:1.11	Thu Nov  4 22:46:22 2004
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp	Thu Apr 21 18:40:47 2005
@@ -1,10 +1,10 @@
 //===- RetracePath.cpp ----------------------------------------------------===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // Retraces a path of BasicBlock, given a path number and a graph!
@@ -25,12 +25,12 @@
 
 //Routines to get the path trace!
 
-void getPathFrmNode(Node *n, vector<BasicBlock*> &vBB, int pathNo, Graph &g, 
-		    vector<Edge> &stDummy, vector<Edge> &exDummy, 
+void getPathFrmNode(Node *n, vector<BasicBlock*> &vBB, int pathNo, Graph &g,
+		    vector<Edge> &stDummy, vector<Edge> &exDummy,
 		    vector<Edge> &be,
 		    double strand){
   Graph::nodeList &nlist = g.getNodeList(n);
-  
+
   //printGraph(g);
   //std::cerr<<"Path No: "<<pathNo<<"\n";
   int maxCount=-9999999;
@@ -53,7 +53,7 @@
   }
 
   if(!isStart)
-    assert(strand!=-1 && "strand not assigned!"); 
+    assert(strand!=-1 && "strand not assigned!");
 
   assert(!(*nextRoot==*n && pathNo>0) && "No more BBs to go");
   assert(!(*nextRoot==*g.getExit() && pathNo-maxCount!=0) && "Reached exit");
@@ -65,7 +65,7 @@
     //look for strnd and edgeRnd now:
     bool has1=false, has2=false;
     //check if exit has it
-    for(vector<Edge>::iterator VI=exDummy.begin(), VE=exDummy.end(); VI!=VE; 
+    for(vector<Edge>::iterator VI=exDummy.begin(), VE=exDummy.end(); VI!=VE;
 	++VI){
       if(VI->getRandId()==edgeRnd){
 	has2=true;
@@ -74,7 +74,7 @@
     }
 
     //check if start has it
-    for(vector<Edge>::iterator VI=stDummy.begin(), VE=stDummy.end(); VI!=VE; 
+    for(vector<Edge>::iterator VI=stDummy.begin(), VE=stDummy.end(); VI!=VE;
 	++VI){
       if(VI->getRandId()==strand){
 	has1=true;
@@ -98,22 +98,22 @@
       //find backedge with startpoint vBB[vBB.size()-1]
       for(vector<Edge>::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] && 
+	if( VI->getFirst()->getElement() == vBB[vBB.size()-1] &&
             VI->getSecond()->getElement() == vBB[0]){
 	  //vBB.push_back(VI->getSecond()->getElement());
 	  break;
 	}
       }
     }
-    else 
+    else
       vBB.push_back(nextRoot->getElement());
-   
+
     return;
   }
 
   assert(pathNo-maxCount>=0);
 
-  return getPathFrmNode(nextRoot, vBB, pathNo-maxCount, g, stDummy, 
+  return getPathFrmNode(nextRoot, vBB, pathNo-maxCount, g, stDummy,
 			exDummy, be, strand);
 }
 
@@ -131,16 +131,16 @@
   //                vector<Instruction *> &instToErase){
   //step 1: create graph
   //Transform the cfg s.t. we have just one exit node
-  
+
   std::vector<Node *> nodes;
   std::vector<Edge> edges;
   Node *exitNode=0, *startNode=0;
 
   //Creat cfg just once for each function!
-  static std::map<Function *, Graph *> graphMap; 
+  static std::map<Function *, Graph *> graphMap;
 
   //get backedges, exit and start edges for the graphs and store them
-  static std::map<Function *, vector<Edge> > stMap, exMap, beMap; 
+  static std::map<Function *, vector<Edge> > stMap, exMap, beMap;
   static std::map<Function *, Value *> pathReg; //path register
 
 
@@ -152,19 +152,19 @@
         break;
       }
     }
-  
+
     assert(ExitNode!=0 && "exitnode not found");
 
-    //iterating over BBs and making graph 
+    //iterating over BBs and making graph
     //The nodes must be uniquely identified:
     //That is, no two nodes must hav same BB*
-  
+
     //keep a map for trigger basicblocks!
     std::map<BasicBlock *, unsigned char> triggerBBs;
     //First enter just nodes: later enter edges
     for(Function::iterator BB = M->begin(), BE=M->end(); BB != BE; ++BB){
       bool cont = false;
-      
+
       if(BB->size()==3 || BB->size() ==2){
         for(BasicBlock::iterator II = BB->begin(), IE = BB->end();
             II != IE; ++II){
@@ -180,10 +180,10 @@
           }
         }
       }
-      
+
       if(cont)
         continue;
-      
+
       // const Instruction *inst = BB->getInstList().begin();
       // if(isa<CallInst>(inst)){
       // Instruction *ii1 = BB->getInstList().begin();
@@ -191,9 +191,9 @@
       // if(callInst->getCalledFunction()->getName()=="trigger")
       // continue;
       // }
-      
+
       Node *nd=new Node(BB);
-      nodes.push_back(nd); 
+      nodes.push_back(nd);
       if(&*BB==ExitNode)
         exitNode=nd;
       if(&*BB==&M->front())
@@ -201,16 +201,16 @@
     }
 
     assert(exitNode!=0 && startNode!=0 && "Start or exit not found!");
- 
+
     for (Function::iterator BB = M->begin(), BE=M->end(); BB != BE; ++BB){
-      if(triggerBBs[BB] == 9) 
+      if(triggerBBs[BB] == 9)
         continue;
-      
+
       //if(BB->size()==3)
       //if(CallInst *callInst = dyn_cast<CallInst>(BB->getInstList().begin()))
       //if(callInst->getCalledFunction()->getName() == "trigger")
       //continue;
-      
+
       // if(BB->size()==2){
       //         const Instruction *inst = BB->getInstList().begin();
       //         if(isa<CallInst>(inst)){
@@ -220,12 +220,12 @@
       //             continue;
       //         }
       //       }
-      
+
       Node *nd=findBB(nodes, BB);
       assert(nd && "No node for this edge!");
-      
+
       for(succ_iterator s=succ_begin(BB), se=succ_end(BB); s!=se; ++s){
-        
+
         if(triggerBBs[*s] == 9){
           //if(!pathReg[M]){ //Get the path register for this!
           //if(BB->size()>8)
@@ -235,11 +235,11 @@
           continue;
         }
         //if((*s)->size()==3)
-        //if(CallInst *callInst = 
+        //if(CallInst *callInst =
         //   dyn_cast<CallInst>((*s)->getInstList().begin()))
         //  if(callInst->getCalledFunction()->getName() == "trigger")
         //    continue;
-        
+
         //  if((*s)->size()==2){
         //           const Instruction *inst = (*s)->getInstList().begin();
         //           if(isa<CallInst>(inst)){
@@ -249,40 +249,40 @@
         //               continue;
         //           }
         //         }
-        
+
         Node *nd2 = findBB(nodes,*s);
         assert(nd2 && "No node for this edge!");
         Edge ed(nd,nd2,0);
         edges.push_back(ed);
       }
     }
-  
+
     graphMap[M]= new Graph(nodes,edges, startNode, exitNode);
- 
+
     Graph *g = graphMap[M];
 
-    if (M->size() <= 1) return; //uninstrumented 
-    
+    if (M->size() <= 1) return; //uninstrumented
+
     //step 2: getBackEdges
     //vector<Edge> be;
     std::map<Node *, int> nodePriority;
     g->getBackEdges(beMap[M], nodePriority);
-    
+
     //step 3: add dummy edges
     //vector<Edge> stDummy;
     //vector<Edge> exDummy;
     addDummyEdges(stMap[M], exMap[M], *g, beMap[M]);
-    
+
     //step 4: value assgn to edges
     int numPaths = valueAssignmentToEdges(*g, nodePriority, beMap[M]);
   }
-  
-  
-  //step 5: now travel from root, select max(edge) < pathNo, 
+
+
+  //step 5: now travel from root, select max(edge) < pathNo,
   //and go on until reach the exit
-  getPathFrmNode(graphMap[M]->getRoot(), vBB, pathNo, *graphMap[M], 
+  getPathFrmNode(graphMap[M]->getRoot(), vBB, pathNo, *graphMap[M],
                  stMap[M], exMap[M], beMap[M], -1);
-  
+
 
   //post process vBB to locate instructions to be erased
   /*






More information about the llvm-commits mailing list