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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ok, this is because we value-number the indirect call result to the result of
the direct call (correctly) but that has no VDEF (it's detected pure) and thus
we fail to value-number the indirect calls VDEF.

@@ -3470,6 +3577,10 @@ visit_reference_op_call (tree lhs, gcall
     {
       if (vnresult->result_vdef && vdef)
        changed |= set_ssa_val_to (vdef, vnresult->result_vdef);
+      else if (vdef)
+       /* If the call was discovered to be pure or const reflect
+          that as far as possible.  */
+       changed |= set_ssa_val_to (vdef, gimple_vuse (stmt));

       if (!vnresult->result && lhs)
        vnresult->result = lhs;

Reply via email to