From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 933F73894E60; Wed, 6 May 2020 08:00:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 933F73894E60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588752034; bh=1MpF2Iab4DbC4v0u17w8CaoJhX5NudY3ZZdwQnELTIY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=O3y2UCPIyFzvnX1bupHYu4ejwORFk/flkrbU32y1t5srzAHZe31W+9sCtApFriftv 4EFf2RrZlC+cVakTOYr/Z3WD2qG0Ln57HU54xK73xGK4DjO4eBlWVQoKw0Nx9RbweR tJkuuVikK/s2nQNhkk2+L/w7ch8xDDVJwAk395Ks= From: "xiezhiheng at huawei dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/94442] [10/11 regression] Redundant loads/stores emitted at -O3 Date: Wed, 06 May 2020 08:00:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: alias, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: xiezhiheng at huawei dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 May 2020 08:00:34 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94442 --- Comment #4 from xiezhiheng at huawei dot com --- (In reply to Richard Biener from comment #3) > So I wonder why >=20 > a$vect_s8$0_4 =3D MEM[(const struct __m256i &)output_5(D) + 32].vect_s8= [0];=20=20 >=20 > 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)) =3D=3D ADDR_EXPR) { tree off =3D TREE_OPERAND (exp, 1); if (!integer_zerop (off)) { poly_offset_int boff =3D mem_ref_offset (exp); boff <<=3D LOG2_BITS_PER_UNIT; bit_offset +=3D boff; } exp =3D 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]=