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 | 70704978af7d37d7951c576ccb7b0cd17053b5a5 (patch) | |
tree | 3a32a06c73424479c98b931d8e4148ea7691d78c | |
parent | 8b30b8dd3366dce0bc486376eed221148a9ce1dd (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97521 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/GVN.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index a7cc9049cd..a4c0716024 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/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(); |