From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 93407382F992; Fri, 7 Oct 2022 12:17:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 93407382F992 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665145036; bh=FPgFIv8kZPY5Gr30UOSkJfGm7XTJqIRwdbS9OSqsdcA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MhTpRbNYLFNNnF3OoSAoILL3mMhbF4QP6E9RqKf0u5oJt8Ksa023Si1c0aukVgmkK s/eyscqLdfQh4+dSZv6UV+j0X4PGnUNQVC6Oqtk9oJpS/7JaKgOm9sRA8wk2aNSLV7 aTDZ4Dk1XSWsSyQKhaUb6UVrUWEHTUhjFXYss554= From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107172] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1268-g8c99e307b20c502e Date: Fri, 07 Oct 2022 12:17:02 +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: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: aldyh at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107172 --- Comment #3 from Aldy Hernandez --- (In reply to Martin Li=C5=A1ka from comment #2) > Started with r13-1268-g8c99e307b20c502e. Disabling DOM with -fno-tree-dominator-opts still causes the crash, so it's= not this patch that caused the problem. Furthermore, the IL at the *.optimized dump looks fine, so this may be an RTL problem. I also disabled VRP's exporting of global ranges to make sure it's not RTL-land making decisions based on global SSA ranges. Also, the revision before r13-1268-g8c99e307b20c502e also fails with -fno-tree-dominator-opts -O1 -ftree-vrp. I tried bisecting this further with -fno-tree-dominator-opts -O1 -ftree-vrp, and ran into: commit f1652e3343b1ec47035370801d9b9aca1f8b613f Author: Roger Sayle Date: Mon May 30 21:26:37 2022 +0100 PR rtl-optimization/101617: Use neg/sbb in ix86_expand_int_movcc. This patch resolves PR rtl-optimization/101617 where we should generate the exact same code for (X ? -1 : 1) as we do for ((X ? -1 : 0) | 1). The cause of the current difference on x86_64 is actually in ix86_expand_int_movcc that doesn't know that negl;sbbl can be used to create a -1/0 result depending on whether the input is zero/nonzero.=