From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 160F53858C56; Mon, 4 Apr 2022 11:20:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 160F53858C56 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/105142] [12 Regression] Wrong code with -O2 since r12-2591 Date: Mon, 04 Apr 2022 11:20:18 +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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.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: Mon, 04 Apr 2022 11:20:19 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105142 --- Comment #10 from Richard Biener --- (In reply to Richard Biener from comment #9) > Created attachment 52745 [details] > avoid combining the conditions >=20 > Like this prototype which fixes the testcase and avoids combining from st= mts > defined in the middle BB. It could be enhanced by only considering not > combining from stmts with undefined overflow behavior (or flow-sensitive > info). >=20 > This patch is also incomplete, maybe_fold_and_comparisons and > maybe_fold_or_comparisons is used by if-conversion, ifcombine and reassoc > and more importantly through recursion with itself and related > simplifications > in gimple-fold.cc. It's not clear where to extract the context BB from a= nd > I didn't follow all the flow through the various routines. Esp. > if-conversion > looks susceptible, reassoc might restrict itself to conditions from the s= ame > BB, not sure. surprisingly(?) the patch has no negative effect on the testsuite (OTOH it = is incomplete and likely test coverage for vectorizer if-conversion is broader= ). I'm unsure whether we want to rush things for GCC 12 and to what extent we want to allow combination from the middle-block(s) (exposing, besides undefined overflow, other flow-sensitive info that depends on the outer condition being short-circuiting).=