Re: [PATCH] Fix unaligned access when predictive commoning (PR 71083)

2016-08-11 Thread Richard Biener
On Thu, 11 Aug 2016, Bernd Edlinger wrote: > On 08/11/16, 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_bin

Re: [PATCH] Fix unaligned access when predictive commoning (PR 71083)

2016-08-11 Thread Bernd Edlinger
On 08/11/16, 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 su

Re: [PATCH] Fix unaligned access when predictive commoning (PR 71083)

2016-08-11 Thread Richard Biener
On Wed, 10 Aug 2016, Bernd Edlinger wrote: > On 08/10/16 14:29, Richard Biener wrote: > > On Tue, 9 Aug 2016, Bernd Edlinger wrote: > >> We know that the difference between the innermost ref > >> and the outer ref is byte-aligned, but we do not know > >> that the same is true for offset between th

Re: [PATCH] Fix unaligned access when predictive commoning (PR 71083)

2016-08-10 Thread Bernd Edlinger
On 08/10/16 14:29, Richard Biener wrote: > On Tue, 9 Aug 2016, Bernd Edlinger wrote: >> We know that the difference between the innermost ref >> and the outer ref is byte-aligned, but we do not know >> that the same is true for offset between the COMPONENT_REF >> and the outer ref. >> >> I mean bof

Re: [PATCH] Fix unaligned access when predictive commoning (PR 71083)

2016-08-10 Thread Richard Biener
On Tue, 9 Aug 2016, Bernd Edlinger wrote: > On 08/09/16 22:48, Eric Botcazou wrote: > >> I think from Eric's comment in get_inner_ref it can be possible > >> in Ada that the outer object is accidentally byte-aligned > >> but the inner reference is not. In that case I think it is > >> better to ge

Re: AW: [PATCH] Fix unaligned access when predictive commoning (PR 71083)

2016-08-10 Thread Eric Botcazou
> I tried to translate the c-test case to an equivalent ada test case with > my not-so-fluent Ada speak... > > So here is a test case that *actually* hits the if ((boff % BITS_PER_UNIT) > != 0) code path. I see, well done then. > Before my patch there was an unaligned SImode access, and with > t

AW: [PATCH] Fix unaligned access when predictive commoning (PR 71083)

2016-08-10 Thread Bernd Edlinger
On 08/10/16, Bernd Edlinger wrote: >On 08/09/16 22:48, Eric Botcazou wrote: >>> I think from Eric's comment in get_inner_ref it can be possible >>> in Ada that the outer object is accidentally byte-aligned >>> but the inner reference is not. In that case I think it is >>> better to generate a BIT_

Re: [PATCH] Fix unaligned access when predictive commoning (PR 71083)

2016-08-09 Thread Bernd Edlinger
On 08/09/16 22:48, Eric Botcazou wrote: >> I think from Eric's comment in get_inner_ref it can be possible >> in Ada that the outer object is accidentally byte-aligned >> but the inner reference is not. In that case I think it is >> better to generate a BIT_FIELD_REF instead of a COMPONENT_REF. >

Re: [PATCH] Fix unaligned access when predictive commoning (PR 71083)

2016-08-09 Thread Eric Botcazou
> I think from Eric's comment in get_inner_ref it can be possible > in Ada that the outer object is accidentally byte-aligned > but the inner reference is not. In that case I think it is > better to generate a BIT_FIELD_REF instead of a COMPONENT_REF. The patch says get_bit_range instead... The

Re: [PATCH] Fix unaligned access when predictive commoning (PR 71083)

2016-08-09 Thread Bernd Edlinger
On 08/09/16 09:29, Richard Biener wrote: > On Mon, 8 Aug 2016, Bernd Edlinger wrote: > >> Hi! >> >> >> As described in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71083 >> we generate unaligned accesses because tree-predcom rewrites >> bitfield and packed accesses in a way that looses the proper >

Re: [PATCH] Fix unaligned access when predictive commoning (PR 71083)

2016-08-09 Thread Richard Biener
On Mon, 8 Aug 2016, Bernd Edlinger wrote: > Hi! > > > As described in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71083 > we generate unaligned accesses because tree-predcom rewrites > bitfield and packed accesses in a way that looses the proper > alignment information. > > The attached patch

[PATCH] Fix unaligned access when predictive commoning (PR 71083)

2016-08-08 Thread Bernd Edlinger
Hi! As described in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71083 we generate unaligned accesses because tree-predcom rewrites bitfield and packed accesses in a way that looses the proper alignment information. The attached patch fixes this by re-using the gimple memory expression from the