From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7E81938386BB; Thu, 15 Dec 2022 17:57:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7E81938386BB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671127055; bh=fUScyJZClgcKkae4Xx6MrySbaFc+z0OXeJCYHjAWRE4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eEmrLW7cklr/mp85QS/J4CjeiPT8yKxyYy54V2/TE13GwKjKmmMmjEXWJDdX1qa+E vgKoW4KyxAbiYtkg7tD0QJw79CMfDK8iQy4z2lq3cyi5v6OlQE/wvcnUo9+kwRbTbw Vm2YpiqMP/GVwHfJra1JuEECrJzPrXniyM2tOf2o= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108129] nop_atomic_bit_test_and_p is too bloated Date: Thu, 15 Dec 2022 17:57:35 +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: internal-improvement X-Bugzilla-Severity: normal 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: 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=3D108129 --- Comment #3 from Richard Biener --- (In reply to Alexander Monakov from comment #0) > match.pd has multi-pattern matcher 'nop_atomic_bit_test_and_p'. >=20 > It expands to ~38 KLOC in gimple-match.cc and ~350 KB in the compiled bin= ary. >=20 > There has to be a better way than repeatedly emitting the match pattern f= or > each member of {ATOMIC,SYNC}_FETCH_{AND,OR_XOR}_N :) It's the way the matcher works - if you can think of a better way of code-generating it within the constraints: - earlier patterns in match.pd should match first in case there are multip= le matches - matching time should ideally be O(size of the pattern) rather than O(siz= e of match.pd) The 2nd constraint isn't currently fulfilled because of the first constraint (or how that is implemented). The 2nd constraint was the original design goal to make frequent "re-folding" cheap. The first constraint was impleme= nted to allow pattern ordering to disambiguate "overlapping" matches. Writing a different code generation in genmatch should be possible, the (lowered) AST is available.=