From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 368BD3858D1E; Thu, 14 Jul 2022 17:03:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 368BD3858D1E From: "amacleod at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106280] dom_oracle::register_transitives is expensive for deep dominator trees Date: Thu, 14 Jul 2022 17:03:12 +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: compile-time-hog X-Bugzilla-Severity: normal X-Bugzilla-Who: amacleod at redhat dot com X-Bugzilla-Status: UNCONFIRMED 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: attachments.created 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: Thu, 14 Jul 2022 17:03:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106280 --- Comment #1 from Andrew Macleod --- Created attachment 53300 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D53300&action=3Dedit proposed patch See if this helps.=20=20 All of the lookup routines check to see first is there is an existing relat= ion for an SSA_NAME before deciding what to do. I forgot to do that with the transitive code. So, this patch does 2 things.=20 1) If a relation is being registered which already exist, the set routine n= ow returns NULL for the record as there will be no new work to do 2) IF this is a new relation, before calling register_transitives checks if either operand was in a relation before (its just a quick bitmap check). If neither was, there is no possibility of a transitive relation, so no need to look. This eliminates a lot of unnecessary work, and based on the pass times spits out at the end, appears to save a lot of time in the various VRP passes (ov= er 50% time reduction) in your test case. It also makes some marginal improvements in GCC source files compilation.=