Change ExplodedNode to have its NodeGroups all BumpPtrAllocated, avoiding malloc() traffic when adding successors/predecessors to a node. This was done by introducing BumpVector, which is essentially SmallVector with all memory being BumpPtrAllocated (this can certainly be cleaned up or moved into llvm/ADT).
This change yields a 1.8% speed increase when running the analyzer (with -analyzer-store=region) on a small benchmark file.
llvm-svn: 83439
diff --git a/clang/lib/Analysis/GRCoreEngine.cpp b/clang/lib/Analysis/GRCoreEngine.cpp
index 909f619..8747247 100644
--- a/clang/lib/Analysis/GRCoreEngine.cpp
+++ b/clang/lib/Analysis/GRCoreEngine.cpp
@@ -372,7 +372,7 @@
ExplodedNode* Node = G->getNode(Loc, State, &IsNew);
if (Pred)
- Node->addPredecessor(Pred); // Link 'Node' with its predecessor.
+ Node->addPredecessor(Pred, *G); // Link 'Node' with its predecessor.
else {
assert (IsNew);
G->addRoot(Node); // 'Node' has no predecessor. Make it a root.
@@ -412,7 +412,7 @@
bool IsNew;
ExplodedNode* Succ = Eng.G->getNode(Loc, N->State, &IsNew);
- Succ->addPredecessor(N);
+ Succ->addPredecessor(N, *Eng.G);
if (IsNew)
Eng.WList->Enqueue(Succ, B, Idx+1);
@@ -471,7 +471,7 @@
ExplodedNode* Pred) {
bool IsNew;
ExplodedNode* N = Eng.G->getNode(Loc, State, &IsNew);
- N->addPredecessor(Pred);
+ N->addPredecessor(Pred, *Eng.G);
Deferred.erase(Pred);
if (IsNew) {
@@ -497,7 +497,7 @@
Eng.G->getNode(BlockEdge(Src,branch ? DstT:DstF,Pred->getLocationContext()),
State, &IsNew);
- Succ->addPredecessor(Pred);
+ Succ->addPredecessor(Pred, *Eng.G);
if (branch)
GeneratedTrue = true;
@@ -529,7 +529,7 @@
ExplodedNode* Succ = Eng.G->getNode(BlockEdge(Src, I.getBlock(),
Pred->getLocationContext()), St, &IsNew);
- Succ->addPredecessor(Pred);
+ Succ->addPredecessor(Pred, *Eng.G);
if (IsNew) {
@@ -552,7 +552,7 @@
ExplodedNode* Succ = Eng.G->getNode(BlockEdge(Src, I.getBlock(),
Pred->getLocationContext()), St, &IsNew);
- Succ->addPredecessor(Pred);
+ Succ->addPredecessor(Pred, *Eng.G);
if (IsNew) {
Eng.WList->Enqueue(Succ);
@@ -574,7 +574,7 @@
ExplodedNode* Succ = Eng.G->getNode(BlockEdge(Src, DefaultBlock,
Pred->getLocationContext()), St, &IsNew);
- Succ->addPredecessor(Pred);
+ Succ->addPredecessor(Pred, *Eng.G);
if (IsNew) {
if (isSink)
@@ -602,7 +602,7 @@
ExplodedNode* Node = Eng.G->getNode(BlockEntrance(&B,
Pred->getLocationContext(), tag), State, &IsNew);
- Node->addPredecessor(P ? P : Pred);
+ Node->addPredecessor(P ? P : Pred, *Eng.G);
if (IsNew) {
Eng.G->addEndOfPath(Node);