From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4AF18385781A; Fri, 8 Apr 2022 08:07:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4AF18385781A From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/105030] store motion if-change flag causes if-conversion optimization can't be taken. Date: Fri, 08 Apr 2022 08:07:24 +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: 12.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de 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: --- 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: Fri, 08 Apr 2022 08:07:25 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105030 --- Comment #14 from rguenther at suse dot de --- On Fri, 8 Apr 2022, guihaoc at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105030 >=20 > --- Comment #13 from HaoChen Gui --- > Could we use the original alias set if the tree code of 'atemp' is var_de= cl? Is > it safe? In which situation we shall use alias-set zero? Thanks. No, just being a VAR_DECL is not good enough. Basically you have to somehow have knowledge about the dynamic type of the object we store to before the store and see whether the conditional store might change that. If so the store needs to use a type that allows accesses to both the original and the possibly changed dynamic type from existing accesses following the now unconditional store. When the access is to a VAR_DECL we can look for the case where the access is to the full variable (partial stores are always difficult to judge wrt dynamic type changes) and whether there is a dominating load (also to the full variable) that either uses the same type or allows us to find a common type to use.=