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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
It looks to me we are using the wrong predicates but maybe the GIMPLE side is
somewhat disconnected here.

Index: gcc/tree-ssa-structalias.c
===================================================================
--- gcc/tree-ssa-structalias.c  (revision 235404)
+++ gcc/tree-ssa-structalias.c  (working copy)
@@ -4642,9 +4642,7 @@ find_func_aliases_for_call (struct funct

          get_constraint_for (lhsop, &lhsc);
          rhs = get_function_part_constraint (fi, fi_result);
-         if (fndecl
-             && DECL_RESULT (fndecl)
-             && DECL_BY_REFERENCE (DECL_RESULT (fndecl)))
+         if (aggregate_value_p (lhsop, gimple_call_fntype (t)))
            {
              auto_vec<ce_s, 2> tem;
              tem.quick_push (rhs);
@@ -4658,9 +4656,7 @@ find_func_aliases_for_call (struct funct

       /* If we pass the result decl by reference, honor that.  */
       if (lhsop
-         && fndecl
-         && DECL_RESULT (fndecl)
-         && DECL_BY_REFERENCE (DECL_RESULT (fndecl)))
+         && aggregate_value_p (lhsop, gimple_call_fntype (t)))
        {
          struct constraint_expr lhs;
          struct constraint_expr *rhsp;

looks correct to me and would also work for indirect calls (though those
are probably "safe" because we don't optimize them very well as we think
having its address taken makes optimization not possible - sth where IPA
PTA needs to be improved).

Reply via email to