On Thu, 11 Aug 2016, Bernd Edlinger wrote:

> On 08/11/16 09:07, Richard Biener wrote:
> > The patch looks mostly ok, but
> >
> > +      else
> > +       {
> > +         boff >>= LOG2_BITS_PER_UNIT;
> > +         boff += tree_to_uhwi (component_ref_field_offset (ref));
> > +         coff = size_binop (MINUS_EXPR, coff, ssize_int (boff));
> >
> > how can we be sure that component_ref_field_offset is an INTEGER_CST?
> > At least Ada can have variably-length fields before a bitfield.  We'd
> > need to apply component_ref_field_offset to off in that case.  Which
> > makes me wonder if we can simply avoid the COMPONENT_REF path in
> > a first iteration of the patch and always build a BIT_FIELD_REF?
> > It should solve the correctness issues as well and be more applicable
> > for branches.
> >
> 
> I believe that it will be necessary to check for tree_fits_uhwi_p here,
> but while it happens quite often hat a normal COMPONENT_REF has a
> variable offset, it happens rarely that a bit-field COMPONENT_REF has a
> variable offset: In the whole Ada test suite it was only on the pack16
> test case. However I was not able to use that trick in the
> loop_optimization23 test case.  When I tried, it did no longer get
> optimized by pcom.  So there will be no new test case at this time.
> 
> Therefore I left the comment as-is, because it is not clear, if a
> variable offset will ever happen here; but if it happens, it will be
> in Ada, and it will be safe to create a BIT_FIELD_REF instead.
> 
> So this is the follow-up patch that tries to create a more aligned
> access using the COMPONENT_REF.
> 
> 
> Boot-strap and reg-test on x86_64-pc-linux-gnu.
> Is it OK for trunk?

Ok.

Thanks,
Richard.

Reply via email to