diff options
author | Hans Wennborg <hans@hanshq.net> | 2015-06-20 17:14:07 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2015-06-20 17:14:07 +0000 |
commit | 6ed81cbcdb6e5f07f6ac71a446d970c2db8945a5 (patch) | |
tree | 9aeb61d8c38c47e8c4ee9c0313f6572ceff2f284 /clang/lib/Serialization/GlobalModuleIndex.cpp | |
parent | 056cbfe58d99fb8224279a948d2fd6eb41a3e5c2 (diff) | |
download | bcm5719-llvm-6ed81cbcdb6e5f07f6ac71a446d970c2db8945a5.tar.gz bcm5719-llvm-6ed81cbcdb6e5f07f6ac71a446d970c2db8945a5.zip |
Switch lowering: add heuristic for filling leaf nodes in the weight-balanced binary search tree
Sparse switches with profile info are lowered as weight-balanced BSTs. For
example, if the node weights are {1,1,1,1,1,1000}, the right-most node would
end up in a tree by itself, bringing it closer to the top.
However, a leaf in this BST can contain up to 3 cases, and having a single
case in a leaf node as in the example means the tree might become
unnecessarily high.
This patch adds a heauristic to the pivot selection algorithm that moves more
cases into leaf nodes unless that would lower their rank. It still doesn't
yield the optimal tree in every case, but I believe it's conservatibely correct.
llvm-svn: 240224
Diffstat (limited to 'clang/lib/Serialization/GlobalModuleIndex.cpp')
0 files changed, 0 insertions, 0 deletions