From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 547E9386F45F; Mon, 13 May 2024 09:49:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 547E9386F45F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715593746; bh=TyO1bgq4XxqkLl8eh4bVjiqn62yX/6spWcHKRAetejo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=A9yL4vgeZ1jEXiDGoxgMM3oI2BmGApB4DIiupqVfogjUUTdKDcQzcRs9MgqvjKuO8 f1TA4GlZsrd5ohima4FZvVsB3mHkcVPZujmCwro6N5dHWozaPK+dRVk3w2tvDCpWB2 L4AyXx8Z99GIeRcLr2ZLrE+csrvkuAWwCR6cvikY= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/115055] reassociation should use match-and-simplify Date: Mon, 13 May 2024 09:49:05 +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: 15.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW 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: bug_status cf_reconfirmed_on everconfirmed 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=3D115055 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2024-05-13 Ever confirmed|0 |1 --- Comment #1 from Richard Biener --- b_5 =3D a_3(D) & c_4(D); _1 =3D a_3(D) =3D=3D 0; _2 =3D (int) _1; _6 =3D b_5 & _2; return _6; I believe reassoc doesn't see that a and (int)(a =3D=3D 0) are "related" wh= en ranking ops of the AND, so it fails to appropriately order them and thus trigger the simplification. We definitely want to avoid doing n^2 matching combos of all AND operands. So confirmed, but not necessarily confirming the proposed solution.=