http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60315
--- Comment #17 from rguenther at suse dot de <rguenther at suse dot de> --- On March 26, 2014 10:58:18 PM CET, hubicka at ucw dot cz <gcc-bugzi...@gcc.gnu.org> wrote: >http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60315 > >--- Comment #16 from Jan Hubicka <hubicka at ucw dot cz> --- >> forwprop would do that, but the enum is unsigned int while the >> switch value is int and thus simplify_gimple_switch bails out >> because the conversion is not value-preserving. >> >> So the frontend would need to be changed here or we need to >> "complicate" the transform by not looking at the type of >> the existing switch argument but instead by looking at the >> actual switch label values to see if their value would be >> preserved. But yes, that enum -> int conversion asked for >> by the C++ standard seems to be common that this should be >> worth the trouble. > >Yep, it seems that the "complicate" transform is actually the most >generic >thing to do. (we won't need to modify all FE's and we will likely get >more >simplifications done) Shall I try to dig into it or you know how to do >that >better? I've posted a patch but it causes some regressions I need to investigate.