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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-10-30

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
  __BB(2):
  c_2 = &b_1(D)->b;
  t_4 = constcall (c_2);
  t1_5 = constcall (b_1(D));
  _6 = t_4 + t1_5;
  return _6;

diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index 0b2c10dcc1a..c52a846abed 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -3975,6 +3975,8 @@ vn_reference_lookup (tree op, tree vuse, vn_lookup_kind
kind,
              == sext_hwi (off.coeffs[0], TYPE_PRECISION (sizetype))))
        {
          gcc_assert (operands[i-1].opcode == MEM_REF);
+         if (known_eq (off, 0))
+           return operands[i].op0;
          tree ops[2];
          ops[0] = operands[i].op0;
          ops[1] = wide_int_to_tree (sizetype, off);

Mine.

Reply via email to