summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-09-02 06:03:18 +0000
committerTed Kremenek <kremenek@apple.com>2009-09-02 06:03:18 +0000
commitcf768cd20235585f485316ace72eb7254bcfcf54 (patch)
treeb17d269f2a2264ae30dedbfa327239611e6b893b
parentd5f4fcceae8e1e9229dbf83a324b49a9954f18bf (diff)
downloadbcm5719-llvm-cf768cd20235585f485316ace72eb7254bcfcf54.tar.gz
bcm5719-llvm-cf768cd20235585f485316ace72eb7254bcfcf54.zip
Replace uses of ImmutableSet in SymbolReaper with DenseSet. This was
motivated from Shark profiles that shows that 'markLive' was very heavy when using --analyzer-store=region. On my benchmark file, this reduces the analysis time for --analyzer-store=region from 19.5s to 13.5s and for --analyzer-store=basic from 5.3s to 3.5s. For the benchmark file, this is a reduction of about 30% analysis time for both analysis modes (a huge win). llvm-svn: 80765
-rw-r--r--clang/include/clang/Analysis/PathSensitive/SymbolManager.h16
-rw-r--r--clang/lib/Analysis/SymbolManager.cpp8
2 files changed, 11 insertions, 13 deletions
diff --git a/clang/include/clang/Analysis/PathSensitive/SymbolManager.h b/clang/include/clang/Analysis/PathSensitive/SymbolManager.h
index d2556cb75c7..1a46e90b419 100644
--- a/clang/include/clang/Analysis/PathSensitive/SymbolManager.h
+++ b/clang/include/clang/Analysis/PathSensitive/SymbolManager.h
@@ -21,8 +21,7 @@
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Allocator.h"
#include "llvm/ADT/FoldingSet.h"
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/ImmutableSet.h"
+#include "llvm/ADT/DenseSet.h"
namespace llvm {
class raw_ostream;
@@ -327,10 +326,8 @@ public:
};
class SymbolReaper {
- typedef llvm::ImmutableSet<SymbolRef> SetTy;
- typedef SetTy::Factory FactoryTy;
+ typedef llvm::DenseSet<SymbolRef> SetTy;
- FactoryTy F;
SetTy TheLiving;
SetTy TheDead;
LiveVariables& Liveness;
@@ -338,8 +335,9 @@ class SymbolReaper {
public:
SymbolReaper(LiveVariables& liveness, SymbolManager& symmgr)
- : TheLiving(F.GetEmptySet()), TheDead(F.GetEmptySet()),
- Liveness(liveness), SymMgr(symmgr) {}
+ : Liveness(liveness), SymMgr(symmgr) {}
+
+ ~SymbolReaper() {}
bool isLive(SymbolRef sym);
@@ -354,12 +352,12 @@ public:
void markLive(SymbolRef sym);
bool maybeDead(SymbolRef sym);
- typedef SetTy::iterator dead_iterator;
+ typedef SetTy::const_iterator dead_iterator;
dead_iterator dead_begin() const { return TheDead.begin(); }
dead_iterator dead_end() const { return TheDead.end(); }
bool hasDeadSymbols() const {
- return !TheDead.isEmpty();
+ return !TheDead.empty();
}
};
diff --git a/clang/lib/Analysis/SymbolManager.cpp b/clang/lib/Analysis/SymbolManager.cpp
index b94551e31f2..d2a82fd1fc9 100644
--- a/clang/lib/Analysis/SymbolManager.cpp
+++ b/clang/lib/Analysis/SymbolManager.cpp
@@ -191,20 +191,20 @@ bool SymbolManager::canSymbolicate(QualType T) {
}
void SymbolReaper::markLive(SymbolRef sym) {
- TheLiving = F.Add(TheLiving, sym);
- TheDead = F.Remove(TheDead, sym);
+ TheLiving.insert(sym);
+ TheDead.erase(sym);
}
bool SymbolReaper::maybeDead(SymbolRef sym) {
if (isLive(sym))
return false;
- TheDead = F.Add(TheDead, sym);
+ TheDead.insert(sym);
return true;
}
bool SymbolReaper::isLive(SymbolRef sym) {
- if (TheLiving.contains(sym))
+ if (TheLiving.count(sym))
return true;
if (const SymbolDerived *derived = dyn_cast<SymbolDerived>(sym)) {
OpenPOWER on IntegriCloud