aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LazyCallGraph.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-04-28 10:37:30 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-04-28 10:37:30 +0000
commit5bdf72cef61095452852731e6a3259709109e009 (patch)
treecab3c973f38ca88eb69c25a4be6bceae92678476 /llvm/lib/Analysis/LazyCallGraph.cpp
parentf9eba2f51d2df7216be07689dbd0497fa07b3818 (diff)
downloadllvm-5bdf72cef61095452852731e6a3259709109e009.zip
llvm-5bdf72cef61095452852731e6a3259709109e009.tar.gz
llvm-5bdf72cef61095452852731e6a3259709109e009.tar.bz2
Fix rampant quadratic behavior in UpdatePHINodes. The operation of
mapping from a basic block to an incoming value, either for removal or just lookup, is linear in the number of predecessors, and we were doing this for every entry in the 'Preds' list which is in many cases almost all of them! Unfortunately, the fixes are quite ugly. PHI nodes just don't make this operation easy. The efficient way to fix this is to have a clever 'remove_if' operation on PHI nodes that lets us do a single pass over all the incoming values of the original PHI node, extracting the ones we care about. Then we could quickly construct the new phi node from this list. This would remove the remaining underlying quadratic movement of unrelated incoming values and the need for silly backwards looping to "minimize" how often we hit the quadratic case. This is the last obvious fix for PR19499. It shaves another 20% off the compile time for me, and while UpdatePHINodes remains in the profile, most of the time is now stemming from the well known inefficiencies of LVI and jump threading. llvm-svn: 207409
Diffstat (limited to 'llvm/lib/Analysis/LazyCallGraph.cpp')
0 files changed, 0 insertions, 0 deletions