From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12907 invoked by alias); 17 Jun 2014 11:48:15 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 12668 invoked by uid 48); 17 Jun 2014 11:47:43 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/61515] [4.10 Regression] Extremely long compile time for generated code Date: Tue, 17 Jun 2014 11:48:00 -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: 4.10.0 X-Bugzilla-Keywords: compile-time-hog X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.10.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-06/txt/msg01464.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61515 --- Comment #10 from Richard Biener --- All time is spent in invalidate_equivalencies. /* A new value has been assigned to LHS. If necessary, invalidate any equivalences that are no longer valid. */ static void invalidate_equivalences (tree lhs, vec *stack) { for (unsigned int i = 1; i < num_ssa_names; i++) if (ssa_name (i) && SSA_NAME_VALUE (ssa_name (i)) == lhs) record_temporary_equivalence (ssa_name (i), NULL_TREE, stack); if (SSA_NAME_VALUE (lhs)) record_temporary_equivalence (lhs, NULL_TREE, stack); } this is obviously quadratic ... nearly all calls are from static gimple record_temporary_equivalences_from_stmts_at_dest (edge e, vec *stack, tree (*simplify) (gimple, gimple), bool backedge_seen) { ... else if (backedge_seen) invalidate_equivalences (gimple_get_lhs (stmt), stack); } return stmt; } I think you should record a bitmap of SSA names you need to invalidate equivalences to and only at the end of this do a single scan over all SSA names.