[llvm-commits] CVS: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Sep 12 10:37:02 PDT 2003


Changes in directory llvm/lib/Transforms/Scalar:

ScalarReplAggregates.cpp updated: 1.11 -> 1.12

---
Log message:

Minor optimization efficiency improvement:
  - Run mem2reg promotion first
  - Only rerun passes if the previous thing changed something


---
Diffs of the changes:

Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.11 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.12
--- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.11	Thu Sep 11 11:58:31 2003
+++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp	Fri Sep 12 10:36:03 2003
@@ -58,12 +58,14 @@
 
 
 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 @@
 
   BasicBlock &BB = F.getEntryNode();  // Get the entry node for the function
 
-  bool Changed  = false;
+  bool Changed = false;
   
   while (1) {
     Allocas.clear();





More information about the llvm-commits mailing list