[PATCH] [PGO] Hoist hot case statement from switches
Chad Rosier
mcrosier at codeaurora.org
Tue Oct 14 14:44:17 PDT 2014
Hi bruno, bob.wilson, chandlerc, hfinkel, grosbach,
This patch identifies hot cases, based on profile information, and inserts the necessary conditional logic to jump to the hottest case statement prior to getting into the switching logic.
A few comments:
1. I'm still working on getting performance numbers, so feel free to grab the patch and test yourself.
2. The 80% "hot" threshold is entirely arbitrary and likely needs tuning. By default, we don't consider switches with fewer than 4 cases, so 80% seems reasonable, IMHO.
3. I would like to add additional tests, so suggestions are welcome. Also, I'm not sure how to verify profile information is being propagated correctly; the logic looks correct, but I'd like to have a test in place to ensure no future regressions.
The ideal solution would be a balanced binary tree, but this seems to be a reasonable first step.
Chad
http://reviews.llvm.org/D5786
Files:
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
test/CodeGen/AArch64/switch-pgo.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5786.14892.patch
Type: text/x-patch
Size: 10937 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141014/2ec896cc/attachment.bin>
More information about the llvm-commits
mailing list