diff options
author | Chris Lattner <sabre@nondot.org> | 2003-09-12 15:36:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-09-12 15:36:03 +0000 |
commit | fe7ea0da17a1b5150aabbc2e82c5f4a0750dc23e (patch) | |
tree | d66bb8c057641b2d9f82018b33c50bcc6b004579 | |
parent | 37f92e25689bacd2308c92f33d01163478cf5ad1 (diff) |
Minor optimization efficiency improvement:
- Run mem2reg promotion first
- Only rerun passes if the previous thing changed something
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8490 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/ScalarReplAggregates.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 8351674d39..9f2e20f1f6 100644 --- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -58,12 +58,14 @@ Pass *createScalarReplAggregatesPass() { return new SROA(); } bool SROA::runOnFunction(Function &F) { - bool Changed = false, LocalChange; - do { - LocalChange = performScalarRepl(F); - LocalChange |= performPromotion(F); - Changed |= LocalChange; - } while (LocalChange); + bool Changed = performPromotion(F); + while (1) { + bool LocalChange = performScalarRepl(F); + if (!LocalChange) break; // No need to repromote if no scalarrepl + Changed = true; + LocalChange = performPromotion(F); + if (!LocalChange) break; // No need to re-scalarrepl if no promotion + } return Changed; } @@ -75,7 +77,7 @@ bool SROA::performPromotion(Function &F) { BasicBlock &BB = F.getEntryNode(); // Get the entry node for the function - bool Changed = false; + bool Changed = false; while (1) { Allocas.clear(); |