diff options
author | Bob Wilson <bob.wilson@apple.com> | 2010-03-01 23:37:32 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2010-03-01 23:37:32 +0000 |
commit | 892432b7ef020a05efd37edd9b956f3160f70db3 (patch) | |
tree | 95e1ae06079fbc2b77ee5788b88815e526d7d382 | |
parent | f4609d431f249016ad7ea8d5d1cb884249ef4538 (diff) | |
download | bcm5719-llvm-892432b7ef020a05efd37edd9b956f3160f70db3.tar.gz bcm5719-llvm-892432b7ef020a05efd37edd9b956f3160f70db3.zip |
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.
llvm-svn: 97521
-rw-r--r-- | llvm/lib/Transforms/Scalar/GVN.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index a7cc9049cdd..a4c07160249 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -1580,6 +1580,7 @@ bool GVN::processNonLocalLoad(LoadInst *LI, 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 @@ bool GVN::processNonLocalLoad(LoadInst *LI, } 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(); |