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

--- Comment #4 from xiezhiheng at huawei dot com ---
(In reply to Richard Biener from comment #3)
> So I wonder why
> 
>   a$vect_s8$0_4 = MEM[(const struct __m256i &)output_5(D) + 32].vect_s8[0];  
> 
> necessarily emits two RTL insns.  It's likely because get_inner_reference
> will not see through MEM[output_5(D) + 32] but records an extra offset
> from the component-ref which we fail to fold into the MEM generated by
> expansion of the MEM base.

Indeed, get_inner_reference only handles the decl for MEM[&decl, off]
  case MEM_REF:
    /* Hand back the decl for MEM[&decl, off].  */
    if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR)
      {
        tree off = TREE_OPERAND (exp, 1);
        if (!integer_zerop (off))
          {
            poly_offset_int boff = mem_ref_offset (exp);
            boff <<= LOG2_BITS_PER_UNIT;
            bit_offset += boff;
          }
        exp = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
      }
    goto done;

In
  MEM[(const struct __m256i &)output_5(D) + 32].vect_s8[0];
output_5 is a SSA_NAME.
So maybe we could expand to handle the situation like MEM[decl, off]

Reply via email to