[LCG] Actually test the *basic* edge removal bits (IE, the non-SCC
authorChandler Carruth <chandlerc@gmail.com>
Wed, 30 Apr 2014 07:45:27 +0000 (07:45 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 30 Apr 2014 07:45:27 +0000 (07:45 +0000)
commit6253c04fc9aefef98586e181329be742e7bb8d15
tree386506ca61f6a799c33d5e3f94f2dcf2eb3a79bd
parent28ea58283bb8a5f37ca6b41d7296641da570aaca
[LCG] Actually test the *basic* edge removal bits (IE, the non-SCC
bits), and discover that it's totally broken. Yay tests. Boo bug. Fix
the basic edge removal so that it works by nulling out the removed edges
rather than actually removing them. This leaves the indices valid in the
map from callee to index, and preserves some of the locality for
iterating over edges. The iterator is made bidirectional to reflect that
it now has to skip over null entries, and the skipping logic is layered
onto it.

As future work, I would like to track essentially the "load factor" of
the edge list, and when it falls below a threshold do a compaction.

An alternative I considered (and continue to consider) is storing the
callees in a doubly linked list where each element of the list is in
a set (which is essentially the classical linked-hash-table
datastructure). The problem with that approach is that either you need
to heap allocate the linked list nodes and use pointers to them, or use
a bucket hash table (with even *more* linked list pointer overhead!),
etc. It's pretty easy to get 5x overhead for values that are just
pointers. So far, I think punching holes in the vector, and periodic
compaction is likely to be much more efficient overall in the space/time
tradeoff.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207619 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/LazyCallGraph.h
lib/Analysis/LazyCallGraph.cpp
unittests/Analysis/LazyCallGraphTest.cpp