diff options
author | Owen Anderson <resistor@mac.com> | 2007-08-14 18:04:11 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2007-08-14 18:04:11 +0000 |
commit | 3e75a42ee2375ad2ab3fac66777b04a71bc930c8 (patch) | |
tree | 1430db850d7db8a985d5b9363ad1af9f34349b2e | |
parent | 8e8278e7fe66e5cf3f82f7f9b0486699f5ba3cc9 (diff) |
Make GVN iterative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41078 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/GVN.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index 1e9b177ea0..b618d77b7f 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -671,6 +671,7 @@ namespace { DenseMap<BasicBlock*, Value*> &Phis, bool top_level = false); void dump(DenseMap<BasicBlock*, Value*>& d); + bool iterateOnFunction(Function &F); }; char GVN::ID = 0; @@ -944,7 +945,21 @@ bool GVN::processInstruction(Instruction* I, // GVN::runOnFunction - This is the main transformation entry point for a // function. // -bool GVN::runOnFunction(Function &F) { +bool GVN::runOnFunction(Function& F) { + bool changed = false; + bool shouldContinue = true; + + while (shouldContinue) { + shouldContinue = iterateOnFunction(F); + changed |= shouldContinue; + } + + return changed; +} + + +// GVN::iterateOnFunction - Executes one iteration of GVN +bool GVN::iterateOnFunction(Function &F) { // Clean out global sets from any previous functions VN.clear(); availableOut.clear(); |