[MergeFuncs] Efficiently defer functions on merge
authorJF Bastien <jfb@google.com>
Wed, 2 Sep 2015 23:55:23 +0000 (23:55 +0000)
committerJF Bastien <jfb@google.com>
Wed, 2 Sep 2015 23:55:23 +0000 (23:55 +0000)
commit6feb333f9f8a8c4d775246a44b3f0d5e31d9ecf7
tree12e00229c75c55d8839347758f9ac9b1a5a0ddaa
parent8f6c191d6c6516612850f602bc6152506f8186d8
[MergeFuncs] Efficiently defer functions on merge

Summary:
This patch introduces a side table in Merge Functions to
efficiently remove functions from the function set when functions
they refer to are merged. Previously these functions would need to
be compared lg(N) times to find the appropriate FunctionNode in the
tree to defer. With the recent determinism changes, this comparison
is more expensive. In addition, the removal function would not always
actually remove the function from the set (i.e. after remove(F),
there would sometimes still be a node in the tree which contains F).

With these changes, these functions are properly deferred, and so more
functions can be merged. In addition, when there are many merged
functions (and thus more deferred functions), there is a speedup:

chromium: 48678 merged -> 49380 merged; 6.58s -> 5.49s
libxul.so: 41004 merged -> 41030 merged; 8.02s -> 6.94s
mysqld: 1607 merged -> 1607 merged (same); 0.215s -> 0.212s (probably noise)

Author: jrkoenig
Reviewers: jfb, dschuff
Subscribers: llvm-commits, nlewycky
Differential revision: http://reviews.llvm.org/D12537

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246735 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/MergeFunctions.cpp