This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/63464] compare one character to many: faster
- From: "rguenther at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 07 Oct 2014 11:15:07 +0000
- Subject: [Bug tree-optimization/63464] compare one character to many: faster
- Auto-submitted: auto-generated
- References: <bug-63464-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63464
--- Comment #5 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 7 Oct 2014, jakub at gcc dot gnu.org wrote:
> 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.
But you could do preparations and do the actual transform splitting blocks
as a 2nd phase?