https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96245
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |vries at gcc dot gnu.org --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think it isn't really a too special case, of course one shouldn't take it literally and look for a particular call etc. But, generally try to see if all the switch cases are the same except some constant or two (same e.g. in the ICF sense) and if that constant or two is linear vs. the corresponding case. It can be done either in switchconv, or could be perhaps some kind of GIMPLE_SWITCH aware parametrized tail merging/cross jumping. As it would (or could) turn constant expressions into non-constant, I guess we'd need to take some conservative approach with __builtin_constant_p, punt if there is a __builtin_constant_p in the block, either altogether, or if it is among (recursively) the immediate uses of the stmt where the constant(s) appear.