Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane

From: Chad Rosier <mcrosier <at> codeaurora.org>
Subject: Lowering switch statements with PGO
Newsgroups: gmane.comp.compilers.llvm.devel
Date: Monday 15th December 2014 17:57:48 UTC (over 3 years ago)
All,
About two months ago I posted a patch that hoisted the hottest case
statement from a switch statement during ISelLowering.

See: http://reviews.llvm.org/D5786

Sean was rather adamant about using a Huffman tree (and I agree this is a
more complete solution), so I'd like to put a patch together.  That being
said, I have a few questions.

The current switch lowering code sorts based on case values and is lowered
with a combination of binary trees, lookup tables, bit tests and magic. 
If we lower the switch based on branch probabilities, I think the most
reasonable approach would be to disable the lookup tables and stick with a
purely tree structure.  Does anyone object or have opinions on this
matter?

Also, is there a way to determine if branch probabilities are based on
real data or static heuristics?  I assume we'd only want to build a
Huffman tree if we have real data.  Please correct me if I'm wrong.

Comments are very welcome!

 Chad
 
CD: 12ms