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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37699 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2007-06-22 00:43:22 +00:00
parent 82575d8ab1
commit e8138ffeaf

View File

@ -585,6 +585,7 @@ bool GVNPRE::dependsOnInvoke(Value* V) {
/// 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 @@ bool GVNPRE::insertion(Function& F) {
// 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";