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

--- Comment #9 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
OK, so actually there is logic to handle return values (even for consts) but it
has wrong if.  I am testing the attached fix.

diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c
index 7aaf53be8f4..5f33bb5b410 100644
--- a/gcc/ipa-modref.c
+++ b/gcc/ipa-modref.c
@@ -1545,9 +1545,9 @@ merge_call_lhs_flags (gcall *call, int arg, int index,
bool deref,
       tree lhs = gimple_call_lhs (call);
       analyze_ssa_name_flags (lhs, lattice, depth + 1, ipa);
       if (deref)
-       lattice[index].merge (lattice[SSA_NAME_VERSION (lhs)]);
-      else
        lattice[index].merge_deref (lattice[SSA_NAME_VERSION (lhs)], false);
+      else
+       lattice[index].merge (lattice[SSA_NAME_VERSION (lhs)]);
     }
   /* In the case of memory store we can do nothing.  */
   else
@@ -1621,7 +1621,7 @@ analyze_ssa_name_flags (tree name, vec<modref_lattice>
&lattice, int depth,
       else if (gcall *call = dyn_cast <gcall *> (use_stmt))
        {
          tree callee = gimple_call_fndecl (call);
-         /* Return slot optiomization would require bit of propagation;
+         /* Return slot optimization would require bit of propagation;
             give up for now.  */
          if (gimple_call_return_slot_opt_p (call)
              && gimple_call_lhs (call) != NULL_TREE

Reply via email to