[GMR] Make the collection of readers and writers of globals much more
authorChandler Carruth <chandlerc@gmail.com>
Wed, 22 Jul 2015 22:10:05 +0000 (22:10 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 22 Jul 2015 22:10:05 +0000 (22:10 +0000)
commit4cef26eecaa28a1593f52f7a8cba26a3bc38bd54
tree309fc5e507a14c307844bdb32abd8c8da83dbc5b
parent41f0f108a5c37a4463f48dd41eb3e644990a6ae8
[GMR] Make the collection of readers and writers of globals much more
efficient, NFC.

Previously, we built up vectors of function pointers to track readers
and writers. The primary problem here is that we would add the same
function to this vector every time we found an instruction that reads or
writes to the pointer. This could be a *lot* of redudant function
pointers. Instead of doing that, we can use a SmallPtrSet.

This does more than just reduce the size of the list of readers or
writers. We walk the entire lists of each and do a map lookup for each
one. By having sets, we will only do one map lookup per reader or writer
function.

But only one user of the pointer analyzer actually needs this
information, so we can also skip accumulating it (and doing a lot of
heap allocations) for all the other pointer analysis. This is
particularly useful because there are very many more pointers in some of
the other cases.

llvm-svn: 242950
llvm/lib/Analysis/IPA/GlobalsModRef.cpp