Switch lowering in GCC
Comments
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Summary
GCC's switch lowering pass chooses among several strategies depending on case layout: a jump table for dense values (roughly eight table entries per case label is the break-even point), comparison trees for sparse values, outlier splitting that pairs a jump table with separate branches for stray cases, contiguous-range compression that…