[PATCH 2/4] [og11] Unify ARRAY_REF/INDIRECT_REF stripping code in extract_base_bit_offset

Julian Brown julian@codesourcery.com
Wed Jun 2 13:36:53 GMT 2021


On Wed, 2 Jun 2021 13:59:05 +0200
Richard Biener <richard.guenther@gmail.com> wrote:

> On Wed, Jun 2, 2021 at 12:47 PM Julian Brown
> <julian@codesourcery.com> wrote:
> >
> > For historical reasons, it seems that extract_base_bit_offset
> > unnecessarily used two different ways to strip
> > ARRAY_REF/INDIRECT_REF nodes from component accesses. I verified
> > that the two ways of performing the operation gave the same results
> > across the whole testsuite (and several additional benchmarks).  
> 
> But the two code paths clearly do sth different.  The base_ref case
> allows (*p)[i] while the !base_ref does not because TREE_CODE (base)
> != COMPONENT_REF.
> And the !base_ref case for INDIRECT_REF is quite odd, only allowing
> *(x.p) where x.p is of REFERENCE_TYPE.
> 
> Whatever this code is supposed to do ... maybe the "prologue" should
> be inlined at the two callers instead.

Thanks -- I'll go back and look at that bit again. I found it hard to
figure out the intention behind these differences, since AFAIK the
meaning should be the same -- maybe Jakub could weigh in as the
original author of this bit (I believe)?

(I figured something like "we can take this shortcut because we know we
already did XYZ to this bit" -- this part was originally completely
open-coded, i.e. there were two copies of this code, and it's only not
open-coded now because I tried to factor out the common bits...)

Julian


More information about the Gcc-patches mailing list