Minor optimization efficiency improvement:

- Run mem2reg promotion first
  - Only rerun passes if the previous thing changed something

llvm-svn: 8490
This commit is contained in:
Chris Lattner 2003-09-12 15:36:03 +00:00
parent acda7df68b
commit 9a95f2a944
1 changed files with 9 additions and 7 deletions

View File

@ -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();