[llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp

Owen Anderson resistor at mac.com
Thu Jun 21 17:43:44 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

GVNPRE.cpp updated: 1.50 -> 1.51
---
Log message:

Reserve space in vectors before topologically sorting into them.  This improves the time to optimize 403.gcc from 28s to 23.5s.


---
Diffs of the changes:  (+2 -0)

 GVNPRE.cpp |    2 ++
 1 files changed, 2 insertions(+)


Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp
diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.50 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.51
--- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.50	Thu Jun 21 19:20:30 2007
+++ llvm/lib/Transforms/Scalar/GVNPRE.cpp	Thu Jun 21 19:43:22 2007
@@ -585,6 +585,7 @@
 /// above)
 void GVNPRE::clean(SmallPtrSet<Value*, 32>& set) {
   std::vector<Value*> worklist;
+  worklist.reserve(set.size());
   topo_sort(set, worklist);
   
   for (unsigned i = 0; i < worklist.size(); ++i) {
@@ -1173,6 +1174,7 @@
       // If there is more than one predecessor...
       if (pred_begin(BB) != pred_end(BB) && ++pred_begin(BB) != pred_end(BB)) {
         std::vector<Value*> workList;
+        workList.reserve(anticIn.size());
         topo_sort(anticIn, workList);
         
         DOUT << "Merge Block: " << BB->getName() << "\n";






More information about the llvm-commits mailing list