summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-09-12 15:36:03 +0000
committerChris Lattner <sabre@nondot.org>2003-09-12 15:36:03 +0000
commit9a95f2a9447aab5e2ed469e2892a87f48940fa29 (patch)
tree6abd9b85d29dd1d9804e8b0df089694bbeb901a3 /llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
parentacda7df68b64102131b4e302c80c842e0d30b870 (diff)
downloadbcm5719-llvm-9a95f2a9447aab5e2ed469e2892a87f48940fa29.tar.gz
bcm5719-llvm-9a95f2a9447aab5e2ed469e2892a87f48940fa29.zip
Minor optimization efficiency improvement:
- Run mem2reg promotion first - Only rerun passes if the previous thing changed something llvm-svn: 8490
Diffstat (limited to 'llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index 8351674d397..9f2e20f1f6f 100644
--- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/llvm/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();
OpenPOWER on IntegriCloud