mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-15 19:24:33 +00:00
Make GVN iterative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41078 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -671,6 +671,7 @@ namespace {
|
|||||||
DenseMap<BasicBlock*, Value*> &Phis,
|
DenseMap<BasicBlock*, Value*> &Phis,
|
||||||
bool top_level = false);
|
bool top_level = false);
|
||||||
void dump(DenseMap<BasicBlock*, Value*>& d);
|
void dump(DenseMap<BasicBlock*, Value*>& d);
|
||||||
|
bool iterateOnFunction(Function &F);
|
||||||
};
|
};
|
||||||
|
|
||||||
char GVN::ID = 0;
|
char GVN::ID = 0;
|
||||||
@@ -944,7 +945,21 @@ bool GVN::processInstruction(Instruction* I,
|
|||||||
// GVN::runOnFunction - This is the main transformation entry point for a
|
// GVN::runOnFunction - This is the main transformation entry point for a
|
||||||
// function.
|
// 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
|
// Clean out global sets from any previous functions
|
||||||
VN.clear();
|
VN.clear();
|
||||||
availableOut.clear();
|
availableOut.clear();
|
||||||
|
Reference in New Issue
Block a user