[Bug middle-end/52436] BIT_FIELD_REF <MEM_REF <>> should be canonicalized for non-bitfield accesses

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 2 14:09:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52436

--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> 2013-04-02 14:08:57 UTC ---
(In reply to comment #3)
> I'd re-organize it like

Ok, I'll try something like that.

> it avoids building a tree just to feed it into get_addr_base_and_unit_offset

The idea was that there would be almost no cases where this was done and no
simplification occurred. If a transformation is indeed done, building one tree
is not that expensive, especially if it avoids code duplication.

> It also avoids it if the access is not of byte-granularity which
> get_addr_base_and_unit_offset does not even consider (it assumes it is fed
> the argument of an ADDR_EXPR which obviously is byte-aligned).
> 
> The tree-flow-inline.h bits look ok.

In get_addr_base_and_unit_offset_1 I already check if the offset is a multiple
of BITS_PER_UNIT, I should probably check that the size is a multiple as well,
no?

> I'm not sure what you need the forwprop / tree-ssa-propagate changes for.

I need something to call fold on a bit_field_ref of a mem_ref. For PR55266, the
vector lowering pass produces a mem_ref and a bit_field_ref in two distinct
gimple statements, and nothing tries to combine them.



More information about the Gcc-bugs mailing list