This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Remove also 2nd argument for unused delete operator (PR tree-optimization/91270).
On Tue, Jul 30, 2019 at 12:11 PM Martin Liška <mliska@suse.cz> wrote:
>
> On 7/30/19 10:40 AM, Richard Biener wrote:
> > On Tue, Jul 30, 2019 at 10:07 AM Martin Liška <mliska@suse.cz> wrote:
> >>
> >> On 7/30/19 9:46 AM, Martin Liška wrote:
> >>> Anyway that's not a candidate for DCE. I'm testing following patch.
> >>
> >> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> >>
> >> One alternative approach can be to drop DECL_SET_IS_OPERATOR_DELETE in:
> >> cat -n gcc/cp/decl.c | less
> >> ...
> >> 4410 deltype = cp_build_type_attribute_variant (deltype, extvisattr);
> >> 4411 deltype = build_exception_variant (deltype, empty_except_spec);
> >> 4412 opdel = push_cp_library_fn (DELETE_EXPR, deltype, ECF_NOTHROW);
> >> 4413 DECL_SET_IS_OPERATOR_DELETE (opdel, true);
> >> 4414 opdel = push_cp_library_fn (VEC_DELETE_EXPR, deltype, ECF_NOTHROW);
> >> 4415 DECL_SET_IS_OPERATOR_DELETE (opdel, true);
> >> 4416
> >> 4417 if (flag_sized_deallocation)
> >> 4418 {
> >> 4419 /* operator delete (void *, size_t, align_val_t); */
> >> 4420 deltype = build_function_type_list (void_type_node, ptr_type_node,
> >> 4421 size_type_node, align_type_node,
> >> 4422 NULL_TREE);
> >> 4423 deltype = cp_build_type_attribute_variant (deltype, extvisattr);
> >> 4424 deltype = build_exception_variant (deltype, empty_except_spec);
> >> 4425 opdel = push_cp_library_fn (DELETE_EXPR, deltype, ECF_NOTHROW);
> >> 4426 DECL_SET_IS_OPERATOR_DELETE (opdel, true);
> >> 4427 opdel = push_cp_library_fn (VEC_DELETE_EXPR, deltype, ECF_NOTHROW);
> >> 4428 DECL_SET_IS_OPERATOR_DELETE (opdel, true);
> >> 4429 }
> >> 4430 }
> >>
> >> at lines 4426 and 4428.
> >>
> >> Richi what do you prefer?
> >
> > I don't understand why a "not simple" delete operator isn't fine to be
> > DCEd? Does C++
> > somehow allow mismatching size specifications here?
>
> No, they are the same.
>
> > And what's the semantics
> > then?
> >
> > Thus I'd rather go with your earlier patch to mark the op necessary.
>
> Ok, I'm sending tested patch.
>
> Ready for trunk?
OK with the tests in
if (gimple_call_builtin_p (stmt, BUILT_IN_FREE)
- || (is_gimple_call (stmt)
- && gimple_call_operator_delete_p (as_a <gcall *> (stmt))))
-
+ || is_delete_operator)
exchanged (you already compuited is_delete_operator, no need to check for
BUILT_IN_FREE if it is true).
Richard.
> Thanks,
> Martin
>
> >
> > Richard.
> >
> >> Martin
>