[Bug ipa/115033] [12/13/14/15 Regression] Incorrect optimization of by-reference closure fields by fre1 pass since r12-5113-gd70ef65692fced

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 22 14:59:50 GMT 2024


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115033

--- Comment #19 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jan Hubicka from comment #18)
> modref_eaf_analysis::analyze_ssa_name misinterprets EAF flags.  If
> dereferenced
> parameter is passed (to map_iterator in the testcase) it can be returned
> indirectly which in turn makes it to escape into the next function call.
> 
> I am testing:
> 
> diff --git a/gcc/ipa-modref.cc b/gcc/ipa-modref.cc
> index a5adce8ea39..a4e3cc34b4d 100644
> --- a/gcc/ipa-modref.cc
> +++ b/gcc/ipa-modref.cc
> @@ -2571,8 +2571,7 @@ modref_eaf_analysis::analyze_ssa_name (tree name, bool
> deferred)
>                     int call_flags = deref_flags
>                             (gimple_call_arg_flags (call, i), ignore_stores);
>                     if (!ignore_retval && !(call_flags & EAF_UNUSED)
> -                       && !(call_flags & EAF_NOT_RETURNED_DIRECTLY)
> -                       && !(call_flags & EAF_NOT_RETURNED_INDIRECTLY))
> +                       && !(call_flags & (EAF_NOT_RETURNED_DIRECTLY ||
> EAF_NOT_RETURNED_INDIRECTLY)))

`||` looks wrong, I suspect it should be `|`.

>                       merge_call_lhs_flags (call, i, name, false, true);
>                     if (ecf_flags & (ECF_CONST | ECF_NOVOPS))
>                       m_lattice[index].merge_direct_load ();


More information about the Gcc-bugs mailing list