[Bug tree-optimization/63464] compare one character to many: faster
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Oct 7 11:11:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63464
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 33658
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33658&action=edit
gcc5-pr63464.patch
Updated patch for the switchconv, this time checking rtx costs.
As for reassoc, the problem I see is that this kind of optimization needs to
split basic blocks, as left shift by negative or >= word bit size is undefined
behavior, so the expected generated code is probably jump around the left
shift.
I think reassoc pass is not prepared to see splitting of basic blocks, nor
adding new PHI nodes etc. In the:
int
foo (int x)
{
return x == 1 || x == 2 || x == 4 || x == 6 || x == 15 || x == 17;
}
case we actually have 2 basic blocks and there is no other test ored in in
either of the basic blocks, so we could perform it even without creating a new
bb, but I'd say that very often we will not be that lucky.
More information about the Gcc-bugs
mailing list