summaryrefslogtreecommitdiff
path: root/docs/Passes.rst
diff options
context:
space:
mode:
authorStepan Dyatkovskiy <stpworld@narod.ru>2014-12-10 17:42:01 +0000
committerStepan Dyatkovskiy <stpworld@narod.ru>2014-12-10 17:42:01 +0000
commit49126402532be5fd1c21fe6cc189e1fece4cb6c5 (patch)
tree91510a3e9a4d14140319bfc2e8778220f012dd02 /docs/Passes.rst
parent3cd5b83bb82d2199bd4857c760edf4a49255bf84 (diff)
Added documentation for MergeFunctions pass:
Pass looks for equivalent functions that are mergable and folds them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223931 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/Passes.rst')
-rw-r--r--docs/Passes.rst25
1 files changed, 16 insertions, 9 deletions
diff --git a/docs/Passes.rst b/docs/Passes.rst
index 9f4009297ac..3f9534182c7 100644
--- a/docs/Passes.rst
+++ b/docs/Passes.rst
@@ -891,17 +891,24 @@ calls, or transforming sets of stores into ``memset``\ s.
This pass looks for equivalent functions that are mergable and folds them.
-A hash is computed from the function, based on its type and number of basic
-blocks.
+Total-ordering is introduced among the functions set: we define comparison
+that answers for every two functions which of them is greater. It allows to
+arrange functions into the binary tree.
-Once all hashes are computed, we perform an expensive equality comparison on
-each function pair. This takes n^2/2 comparisons per bucket, so it's important
-that the hash function be high quality. The equality comparison iterates
-through each instruction in each basic block.
+For every new function we check for equivalent in tree.
-When a match is found the functions are folded. If both functions are
-overridable, we move the functionality into a new internal function and leave
-two overridable thunks to it.
+If equivalent exists we fold such functions. If both functions are overridable,
+we move the functionality into a new internal function and leave two
+overridable thunks to it.
+
+If there is no equivalent, then we add this function to tree.
+
+Lookup routine has O(log(n)) complexity, while whole merging process has
+complexity of O(n*log(n)).
+
+Read
+:doc:`this <MergeFunctions>`
+article for more details.
``-mergereturn``: Unify function exit nodes
-------------------------------------------