This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR70497, missed "subreg" CSE on GIMPLE
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 9 May 2016 15:25:16 +0200 (CEST)
- Subject: Re: [PATCH] Fix PR70497, missed "subreg" CSE on GIMPLE
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1605091444000 dot 18037 at t29 dot fhfr dot qr>
- Reply-to: gcc-patches at gcc dot gnu dot org
On Mon, 9 May 2016, Richard Biener wrote:
The following patch implements CSEing of "subreg" reads from memory
like (from the testcase in the PR)
union U { int i[16]; char c; };
char foo(int i)
{
union U u;
u.i[0] = i;
return u.c;
}
CSEing u.c as (char)i and thus removing u during GIMPLE optimizations.
The patch always goes via generating BIT_FIELD_REFs and letting them
be simplified via the match-and-simplify machinery. This means it
replaces handling of complex component and vector extracts we've been
able to do before.
I didn't restrict the kind of BIT_FIELD_REFs much apart from requiring
byte-size accesses. I did inspect code generated on powerpc (big-endian)
for the testcase though (also to verify any endianess issues) and didn't
spot anything wrong (even for non-lowpart "subregs").
I expect this will also fix
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28367 (reading an element
from a vector through a union)?
--
Marc Glisse