[Bug tree-optimization/63464] compare one character to many: faster

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Oct 13 15:51:00 GMT 2014


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?)
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.



More information about the Gcc-bugs mailing list