This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Speedup gimple_split_block
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 10 Mar 2015 12:58:56 +0100 (CET)
- Subject: [PATCH] Speedup gimple_split_block
- Authentication-results: sourceware.org; auth=none
This removes the old vestige loop to find a gsi for a stmt (from times
where gsi_for_stmt was O(n)).
PR44563 shows gimple_split_block quite high in the profile (this
patch doesn't fix that) as the tail loop setting BB on all stmts
moved to the new block shows quadratic behavior when inlining
N calls in a basic-block.
Bootstrap and regtest scheduled on x86_64-unknown-linux-gnu.
Richard.
2015-03-10 Richard Biener <rguenther@suse.de>
* tree-cfg.c (gimple_split_block): Remove loop finding stmt
to split on.
Index: gcc/tree-cfg.c
===================================================================
*** gcc/tree-cfg.c (revision 221277)
--- gcc/tree-cfg.c (working copy)
*************** gimple_split_block (basic_block bb, void
*** 5697,5722 ****
FOR_EACH_EDGE (e, ei, new_bb->succs)
e->src = new_bb;
! if (stmt && gimple_code ((gimple) stmt) == GIMPLE_LABEL)
! stmt = NULL;
!
/* Move everything from GSI to the new basic block. */
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- {
- act = gsi_stmt (gsi);
- if (gimple_code (act) == GIMPLE_LABEL)
- continue;
-
- if (!stmt)
- break;
-
- if (stmt == act)
- {
- gsi_next (&gsi);
- break;
- }
- }
-
if (gsi_end_p (gsi))
return new_bb;
--- 5723,5735 ----
FOR_EACH_EDGE (e, ei, new_bb->succs)
e->src = new_bb;
! /* Get a stmt iterator pointing to the first stmt to move. */
! if (!stmt || gimple_code ((gimple) stmt) == GIMPLE_LABEL)
! gsi = gsi_after_labels (bb);
! else
! gsi = gsi_for_stmt ((gimple) stmt);
!
/* Move everything from GSI to the new basic block. */
if (gsi_end_p (gsi))
return new_bb;