aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/LiveVariables.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-10-02 01:45:37 +0000
committerTed Kremenek <kremenek@apple.com>2011-10-02 01:45:37 +0000
commit3c2b5f7d6102bd1878c4ce7fcdd8f67ec9c37064 (patch)
treeaed40fa063f657b8172df0fa7658afb7d29e889a /lib/Analysis/LiveVariables.cpp
parentd1e40d5389a4382cbebc97d54792f41ee0414af4 (diff)
Fix another major performance regression in LiveVariables by not canonicalizing the underlying ImmutableSets on every analyzed statement (just at merges). Fixes <rdar://problem/10087538>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140958 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/LiveVariables.cpp')
-rw-r--r--lib/Analysis/LiveVariables.cpp7
1 files changed, 6 insertions, 1 deletions
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());
}