[llvm-commits] [llvm] r97521 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp
Bob Wilson
bob.wilson at apple.com
Mon Mar 1 15:37:32 PST 2010
Author: bwilson
Date: Mon Mar 1 17:37:32 2010
New Revision: 97521
URL: http://llvm.org/viewvc/llvm-project?rev=97521&view=rev
Log:
When GVN needs to split critical edges for load PRE, check all of the
predecessors before returning. Otherwise, if multiple predecessor edges need
splitting, we only get one of them per iteration. This makes a small but
measurable compile time improvement with -enable-full-load-pre.
Modified:
llvm/trunk/lib/Transforms/Scalar/GVN.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=97521&r1=97520&r2=97521&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Mar 1 17:37:32 2010
@@ -1580,6 +1580,7 @@
for (unsigned i = 0, e = UnavailableBlocks.size(); i != e; ++i)
FullyAvailableBlocks[UnavailableBlocks[i]] = false;
+ bool NeedToSplitEdges = false;
for (pred_iterator PI = pred_begin(LoadBB), E = pred_end(LoadBB);
PI != E; ++PI) {
BasicBlock *Pred = *PI;
@@ -1596,9 +1597,11 @@
}
unsigned SuccNum = GetSuccessorNumber(Pred, LoadBB);
toSplit.push_back(std::make_pair(Pred->getTerminator(), SuccNum));
- return false;
+ NeedToSplitEdges = true;
}
}
+ if (NeedToSplitEdges)
+ return false;
// Decide whether PRE is profitable for this load.
unsigned NumUnavailablePreds = PredLoads.size();
More information about the llvm-commits
mailing list