https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63464
--- Comment #11 from rguenther at suse dot de <rguenther at suse dot de> --- On Mon, 13 Oct 2014, jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63464 > > --- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > Created attachment 33697 > --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33697&action=edit > gcc5-pr63464.patch > > WIP patch. What is missing: > 1) the optimize_range_tests_to_bit_test call should be guarded by > lshift_cheap_p (), Richard, any preference on where to declare that function > (tree-switch-conversion.h and include that in tree-ssa-reassoc.c, somewhere > else?) In optabs.[ch]? > 2) much more importantly, it right now doesn't actually fixup the IL, so > instead of the desirable jump around the shift we have there just > BIT_IOR_EXPR (and the shift actually happens to be done first, before > the range test). Richard, any preference how to represent it in the IL > from in between the optimization and fixup once all bbs are > reassociated? I've been thinking about e.g. some pass-through internal > call on the TRUTH_ORIF_EXPR operand. Another option might be, if we'd > adjust update_range_test, so that it would not only emit a > gimplification of the range test, but also an optional gimple_seq before > that, would be to push all the SSA_NAMEs that would be otherwise passed > to the internal call, into some vector, and just split bb after the def > stmt of those SSA_NAMEs and also before the (single, hopefully) user of > that SSA_NAME, adding an edge around the middle of the bb and PHI. Can't you "queue" the BIT_IOR_EXPR stmt somewhere and after reassoc finished split the BBs as desired? Richard.