[cfe-commits] r140958 - /cfe/trunk/lib/Analysis/LiveVariables.cpp

Ted Kremenek kremenek at apple.com
Sat Oct 1 18:45:38 PDT 2011


Author: kremenek
Date: Sat Oct  1 20:45:37 2011
New Revision: 140958

URL: http://llvm.org/viewvc/llvm-project?rev=140958&view=rev
Log:
Fix another major performance regression in LiveVariables by not canonicalizing the underlying ImmutableSets on every analyzed statement (just at merges).  Fixes <rdar://problem/10087538>.

Modified:
    cfe/trunk/lib/Analysis/LiveVariables.cpp

Modified: cfe/trunk/lib/Analysis/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/LiveVariables.cpp?rev=140958&r1=140957&r2=140958&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/lib/Analysis/LiveVariables.cpp Sat Oct  1 20:45:37 2011
@@ -205,7 +205,10 @@
   void dumpBlockLiveness(const SourceManager& M);
 
   LiveVariablesImpl(AnalysisContext &ac, bool KillAtAssign)
-    : analysisContext(ac), killAtAssign(KillAtAssign) {}
+    : analysisContext(ac),
+      SSetFact(false), // Do not canonicalize ImmutableSets by default.
+      DSetFact(false), // This is a *major* performance win.
+      killAtAssign(KillAtAssign) {}
 };
 }
 
@@ -255,6 +258,8 @@
   SSetRefA = mergeSets(SSetRefA, SSetRefB);
   DSetRefA = mergeSets(DSetRefA, DSetRefB);
   
+  // asImmutableSet() canonicalizes the tree, allowing us to do an easy
+  // comparison afterwards.
   return LiveVariables::LivenessValues(SSetRefA.asImmutableSet(),
                                        DSetRefA.asImmutableSet());  
 }





More information about the cfe-commits mailing list