[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp

Anand Shukla ashukla at cs.uiuc.edu
Fri Feb 14 14:38:01 PST 2003


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

ProfilePaths.cpp updated: 1.24 -> 1.25

---
Log message:

Changes to runtime framework

---
Diffs of the changes:

Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.24 llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.25
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.24	Tue Jan 14 16:33:56 2003
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp	Fri Feb 14 14:37:42 2003
@@ -155,6 +155,8 @@
   // numPaths is the number of acyclic paths in the graph
   int numPaths=valueAssignmentToEdges(g, nodePriority, be);
 
+  //if(numPaths<=1) return false;
+
   if(numPaths<=1 || numPaths >5000) return false;
   
 #ifdef DEBUG_PATH_PROFILES  
@@ -172,10 +174,17 @@
     AllocaInst(Type::IntTy, 
                ConstantUInt::get(Type::UIntTy,1),"R");
 
-  Instruction *countVar=new 
-    AllocaInst(Type::IntTy, 
-               ConstantUInt::get(Type::UIntTy, numPaths), "Count");
-  
+  //Instruction *countVar=new 
+  //AllocaInst(Type::IntTy, 
+  //           ConstantUInt::get(Type::UIntTy, numPaths), "Count");
+
+  //initialize counter array!
+  std::vector<Constant*> arrayInitialize;
+  for(int xi=0; xi<numPaths; xi++)
+    arrayInitialize.push_back(ConstantSInt::get(Type::IntTy, 0));
+
+  Constant *initializer =  ConstantArray::get(ArrayType::get(Type::IntTy, numPaths), arrayInitialize);
+  GlobalVariable *countVar = new GlobalVariable(ArrayType::get(Type::IntTy, numPaths), false, true, initializer, "Count", F.getParent());
   static GlobalVariable *threshold = NULL;
   static bool insertedThreshold = false;
 
@@ -191,7 +200,7 @@
 
   // insert initialization code in first (entry) BB
   // this includes initializing r and count
-  insertInTopBB(&F.getEntryNode(),numPaths, rVar, countVar, threshold);
+  insertInTopBB(&F.getEntryNode(),numPaths, rVar, threshold);
     
   //now process the graph: get path numbers,
   //get increments along different paths,





More information about the llvm-commits mailing list