From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 401D73857C5B; Wed, 7 Oct 2020 15:30:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 401D73857C5B From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/97307] Optimization for pure vs. const function Date: Wed, 07 Oct 2020 15:30:14 +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.2.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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, 07 Oct 2020 15:30:14 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97307 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #7 from Jakub Jelinek --- (In reply to Richard Biener from comment #3) > The patch will cause >=20 > FAIL: gcc.dg/vect/pr65947-3.c scan-tree-dump-times vect "LOOP VECTORIZED"= 2 >=20 > since the testcase has exactly such a pattern: >=20 > unsigned int > condition_reduction (unsigned int *a, unsigned int min_v, unsigned int *b) > { > unsigned int last =3D N + 65; > unsigned int aval; >=20 > for (unsigned int i =3D 0; i < N; i++) > { > aval =3D a[i]; > if (b[i] < min_v) > last =3D aval; > } > return last; > } >=20 > and sinking the aval =3D a[i] load causes if-conversion to no longer happ= en > because a[i] now appears to only conditionally trap. It will be vectoriz= ed > with masked loads if those are available though, so I'm considering to > XFAIL it for the moment. Isn't that an important real-world case though? I mean, people who care a = lot about the vectorization often change code from the loads in the conditional= s to preloading the value before the condition, such that it can be vectorized a= nd now it won't (and masked loads are less common among architectures that can vectorize such loops than non-masked ones). So shouldn't we just sink that way calls before vectorization and after vectorization everything? Or have some way to tell ifcvt it can undo the sinking.=