Commit Message

> As I'm not sure how to best do that I suggest we do a more proper RTL> DSE hack by adding a 'libcall-call-escape'-set which we can add to> instead of calling mark_addressable this late. We need to add all> partitions of a decl here, of course, and we need to query it from> can_escape.
That doesn't pertain only to libcalls though, mark_addressable can also be
called for regular calls if arguments are callee-copied. And mark_addressable
has also been called from expand_asm_operands for ages.
> Well, it just means that the enhanced DSE is fragile :/
Maybe, but the current implementation is the outcome of a discussion between
Easwaran and you IIRC. In any case, before attempting to rewrite everything,
here is another approach that patches things up by extending the usage of the
TREE_ADDRESSABLE bit from the vars in a partition to the artificial pointer to
that partition, i.e. the bit is set on the artificial pointer if it is set on
at least one variable in the partition.
Tested on x86_64-suse-linux.
PR rtl-optimization/54870
* tree.h (TREE_ADDRESSABLE): Document special usage of SSA_NAME.
* cfgexpand.c (update_alias_info_with_stack_vars ): Set it on the
SSA_NAME pointer that points to a partition if there is at least
one variable with it set in the partition.
* dse.c (local_variable_can_escape): New predicate.
(can_escape): Call it.
* gimplify.c (mark_addressable): If this is a partitioned decl, mark
the SSA_NAME pointer that points to a partition as well.

Comments

On Tue, Oct 16, 2012 at 11:39 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> As I'm not sure how to best do that I suggest we do a more proper RTL>> DSE hack by adding a 'libcall-call-escape'-set which we can add to>> instead of calling mark_addressable this late. We need to add all>> partitions of a decl here, of course, and we need to query it from>> can_escape.>> That doesn't pertain only to libcalls though, mark_addressable can also be> called for regular calls if arguments are callee-copied. And mark_addressable> has also been called from expand_asm_operands for ages.
Hm, I see ...
>> Well, it just means that the enhanced DSE is fragile :/>> Maybe, but the current implementation is the outcome of a discussion between> Easwaran and you IIRC. In any case, before attempting to rewrite everything,> here is another approach that patches things up by extending the usage of the> TREE_ADDRESSABLE bit from the vars in a partition to the artificial pointer to> that partition, i.e. the bit is set on the artificial pointer if it is set on> at least one variable in the partition.
Ok, I like that a lot more - can_escape now properly checks all partition vars
and the use of TREE_ADDRESSABLE on the SSA-NAME is a nice idea.
Less ideal is the mark_addressable change but I can't see any better
way to deal with late addressable markings ...
> Tested on x86_64-suse-linux.
... thus, ok!
Thanks,
Richard.
>> PR rtl-optimization/54870> * tree.h (TREE_ADDRESSABLE): Document special usage of SSA_NAME.> * cfgexpand.c (update_alias_info_with_stack_vars ): Set it on the> SSA_NAME pointer that points to a partition if there is at least> one variable with it set in the partition.> * dse.c (local_variable_can_escape): New predicate.> (can_escape): Call it.> * gimplify.c (mark_addressable): If this is a partitioned decl, mark> the SSA_NAME pointer that points to a partition as well.>>> --> Eric Botcazou