[PATCH] Fix expansion of BLKmode MEM_REF with non-addressable non-BLKmode base decl (PR middle-end/51895)

Richard Guenther rguenther@suse.de
Thu Jan 26 14:22:00 GMT 2012


On Thu, 26 Jan 2012, Eric Botcazou wrote:

> > Of course get_inner_reference looks through these kind of
> > conversions when returning the ultimate decl in MEM [&foo],
> > see the jumps in tree-ssa-alias.c we perform to re-discover
> > the view-converting cases ... (at some point I realized that
> > this probably wasn't the best design decision).  So maybe
> > if the passed type isn't used in any other way we can
> > get around and discover the view-convert and use the alias-type
> > of the MEM_REF ...
> 
> But I presume that the regular MEM_REF expander can cope with this case?

Sure.

Btw, we seem to use the TYPE argument solely for the purpose of
the assign_temp call - and in the forwarding to store_field
we pass down the very same alias_set which isn't needed,
we can just use MEM_ALIAS_SET (blk_object) here it seems,
it's different memory after all, no need to conflict with TARGET
(or set MEM_KEEP_ALIAS_SET_P - what's that ..., ah, DECL_NONADDRESSABLE 
...).

Of course if you can simplify the code by using the regular
expander all the better (and eliminate the TYPE argument?).

@@ -6299,7 +6302,7 @@ store_field (rtx target, HOST_WIDE_INT b
 
       store_field (blk_object, bitsize, bitpos,
                   bitregion_start, bitregion_end,
-                  mode, exp, type, alias_set, nontemporal);
+                  mode, exp, type, MEM_ALIAS_SET (blk_object), 
nontemporal);
 
       emit_move_insn (target, object);
 

works for me.

Thanks,
Richard.



More information about the Gcc-patches mailing list