https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103072
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |marxin at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- We optimize the second function to: void baz(int x) { switch(x) { case 1: func2(1); break; case 2: func2(2); break; case 3: func2(3); break; case 4: func2(4); break; case 5: func2(5); break; default: __builtin_unreachable(); } } during evrp and cross-jumping isn't able to merge it then. Users could very well write it the above way too. So maybe the switchconv pass could be improved not to do just the linear etc. expression handling, but also consider code sequences that are the same except for the linear expression somewhere in it and turn it back into use of a temporary.