From 3c2b5f7d6102bd1878c4ce7fcdd8f67ec9c37064 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Sun, 2 Oct 2011 01:45:37 +0000 Subject: [PATCH] Fix another major performance regression in LiveVariables by not canonicalizing the underlying ImmutableSets on every analyzed statement (just at merges). Fixes . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140958 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/LiveVariables.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp index 055b58ca81..be6e659bd9 100644 --- a/lib/Analysis/LiveVariables.cpp +++ b/lib/Analysis/LiveVariables.cpp @@ -205,7 +205,10 @@ public: 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 @@ LiveVariablesImpl::merge(LiveVariables::LivenessValues valsA, 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()); } -- 2.40.0