https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125307
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- Huh, we don't have a bug for this already? ;) I'll note it's a bit difficult - there's both CASE_LABELs (with the range info) and the target BBs to consider and there's no 1:1 relation but it's a N:1 one. Also GIMPLE exists with and without of a CFG. That said, while this was on my TODO as well (for a long time ...) I have no complete design to share. I'd like to avoid enlarging 'edge' though it would feel naturally to move the case labels to the edges. Changing the CASE_LABEL_EXPRs to record the 'edge' would be an option (a little awkward, but maybe not so much given we have a bb reference in each stmt as well). It would certainly be the least intrusive change. It would not solve the backward lookup of case-label exprs from an edge (not sure how often we do that). That said, we need an idea how often which kind of lookup is performed. label_to_block might be also solved by actually recording glabel instead of a LABEL_DECL. tcc_declaration might have unused room to store glabel as well.
