From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 757C83858C27; Wed, 22 Sep 2021 07:18:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 757C83858C27 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102436] [11/12 Regression] Lost Load/Store Motion Date: Wed, 22 Sep 2021 07:18:54 +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: 11.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: everconfirmed target_milestone priority keywords assigned_to cf_reconfirmed_on bug_status 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, 22 Sep 2021 07:18:54 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102436 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Target Milestone|--- |11.3 Priority|P3 |P2 Keywords| |missed-optimization Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot = gnu.org Last reconfirmed| |2021-09-22 Status|UNCONFIRMED |ASSIGNED --- Comment #1 from Richard Biener --- Memory reference 3: numb_moves Memory reference 4: _24->from ... Querying dependency of refs 3 and 4: dependent. Querying SM WAW dependencies of ref 3 in loop 1: dependent the issue is that we require conditional executed stores to be independent on all other stores as we cannot re-issue other stores on exit in the proper order. Now, in this case the dependent stores are executed under the same condition and in fact ordered in a way that we don't have to re-issue any dependent store. We're failing to handle this special case after the store-motion re-write t= hat fixed the TBAA issues. Smaller testcase where we can just issue the conditional store to 'p': unsigned p; void foo (float *q) { for (int i =3D 0; i < 256; ++i) { if (p) { unsigned a =3D p; *(q++) =3D 1.; p =3D a + 1; } } } the following are what's very much more difficult to handle (we have to issue a conditional sequence of two stores, and remember the location the non-invariant store stored to _and_ verify we can re-emit that out-of-order, and we have to remember the value stored): unsigned p; void foo (float *q) { for (int i =3D 0; i < 256; ++i) { if (p) { unsigned a =3D p; p =3D a + 1; *(q++) =3D 1.; } } } a bit easier (the store we have to re-issue is always executed after the last conditional store): unsigned p; void foo (float *q) { for (int i =3D 0; i < 256; ++i) { if (p) { unsigned a =3D p; p =3D a + 1; } *(q++) =3D 1.; } } impossible / invalid: unsigned p; void foo (float *q) { for (int i =3D 0; i < 256; ++i) { *(q++) =3D 1.; if (p) { unsigned a =3D p; p =3D a + 1; } } } I will see how difficult it is to teach the already interwinded code the "trivial" case and whether the bit easier case falls out naturally.=