This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: DCE enhancement to delete dead vptr assignment


On Fri, Apr 16, 2010 at 7:01 PM, Xinliang David Li <davidxl@google.com> wrote:
> On Fri, Apr 16, 2010 at 9:29 AM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
>> On Fri, Apr 16, 2010 at 6:09 PM, Xinliang David Li <davidxl@google.com> wrote:
>>> This is related to PR34949. It makes use C++ language semantics.
>>> Currently it handles empty dtors or their inline instances into
>>> deleting dtors or inline instances into callers followed by delete
>>> call. ?It will extend automatically to handle other cases (e.g. dtor
>>> with printf statement etc) when more precise alias/mod-ref or builtin
>>> function side effect information is available.
>>>
>>> bootstrap and regression on x86-64/linux
>>>
>>> Ok for mainline?
>>
>> I don't think this is a step in the right direction, in tree-ssa-dce.c:

I agree.

>> + ? ?{
>> + ? ? ?/* Initialization of the vptr field for the same object this
>> + ? ? ? ? destructor is operating on won't be live out of the function
>> + ? ? ? ?if it is not used within the function, so do not treat them
>> + ? ? ? ?as a hidden global store. ?*/
>> + ? ? ?if (lang_hooks.decls.is_decl_dtor (current_function_decl))
>> + ? ? ? ?{
>
> Do you want me to wrap it in a wrapper function?

How would that change anything?

>>
>> We should not be calling lang hooks from the optimizers.
>>
>> How would this work with inter-language IPA?
>
> When can the tree structure be flatten out so that there is no
> language specific attributes? Until then, what is the solution?
> Inter-language IPA? When do we plan to have full support of that?

We do have full support for that.

How often does this patch trigger?  How can you be sure that ::delete
is not overridden with something doing something completely
non-standard (that's the reason why we have ::new not annotated
with the malloc attribute)?

Btw, we already can delete stores to malloced memory that is
"killed" by free.  Why do we need all this fancy stuff and can't
use the same mechanisms?

Thanks,
Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]