]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
invoke.texi: Document max-jump-thread-duplication-stmts PARAM.
authorJeff Law <law@redhat.com>
Fri, 4 Nov 2005 20:09:25 +0000 (13:09 -0700)
committerJeff Law <law@gcc.gnu.org>
Fri, 4 Nov 2005 20:09:25 +0000 (13:09 -0700)
* doc/invoke.texi: Document max-jump-thread-duplication-stmts PARAM.
* tree-ssa-dom.c: Include params.h.
(thread_across_edge): If there are too many statements in the
target block, then do not thread through it.
* Makefile.in (tree-ssa-dom.o): Depend on $(PARAMS_H).
* params.def (PARAM_MAX_JUMP_THREAD_DUPLICATION_STMTS): New PARAM.

From-SVN: r106503

gcc/ChangeLog
gcc/Makefile.in
gcc/doc/invoke.texi
gcc/params.def
gcc/tree-ssa-dom.c

index b7c1bb9a66588f92ce5eae6f2243147d4be16e84..9bf6a7ca3e4c771371f1a0fd74b3da7196c0d17b 100644 (file)
@@ -1,3 +1,13 @@
+2005-10-04  Jeff Law  <law@redhat.com>
+
+       PR/21883
+       * doc/invoke.texi: Document max-jump-thread-duplication-stmts PARAM.
+       * tree-ssa-dom.c: Include params.h.
+       (thread_across_edge): If there are too many statements in the
+       target block, then do not thread through it.
+       * Makefile.in (tree-ssa-dom.o): Depend on $(PARAMS_H).
+       * params.def (PARAM_MAX_JUMP_THREAD_DUPLICATION_STMTS): New PARAM.
+
 2005-11-03  Diego Novillo  <dnovillo@redhat.com>
 
        PR 24627
index db66fbc95e1a1b72ba093b295073912fd72a89fb..8bba4e097b456da1b88c08ab2dae38b72578d02f 100644 (file)
@@ -1791,7 +1791,7 @@ tree-ssa-dom.o : tree-ssa-dom.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
    $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h $(DIAGNOSTIC_H) \
    function.h $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
    $(BASIC_BLOCK_H) domwalk.h real.h tree-pass.h $(FLAGS_H) langhooks.h \
-   tree-ssa-propagate.h $(CFGLOOP_H)
+   tree-ssa-propagate.h $(CFGLOOP_H) $(PARAMS_H)
 tree-ssa-uncprop.o : tree-ssa-uncprop.c $(TREE_FLOW_H) $(CONFIG_H) \
    $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h \
    $(DIAGNOSTIC_H) function.h $(TIMEVAR_H) $(TM_H) coretypes.h \
index eda329a76842ca0a81e72881d419ea52c4819664..5662786911a8ffcf3f136eb055b4b6b32548ac09 100644 (file)
@@ -6085,6 +6085,9 @@ ratio is 3.
 The minimum size of buffers (i.e. arrays) that will receive stack smashing
 protection when @option{-fstack-protection} is used.
 
+@item max-jump-thread-duplication-stmts
+Maximum number of statements allowed in a block that needs to be
+duplicated when threading jumps.
 @end table
 @end table
 
index f808682a06fb42126facf6e75c7dabda80b8a747..f0740a9d00f1e06f619b666fa958fa97ffa8e545 100644 (file)
@@ -506,6 +506,24 @@ DEFPARAM (PARAM_SSP_BUFFER_SIZE,
          "The lower bound for a buffer to be considered for stack smashing protection",
          8, 1, 0)
 
+/* When we thread through a block we have to make copies of the
+   statements within the block.  Clearly for large blocks the code
+   duplication is bad.
+
+   PARAM_MAX_JUMP_THREAD_DUPLICATION_STMTS specifies the maximum number
+   of statements and PHI nodes allowed in a block which is going to
+   be duplicated for thread jumping purposes.
+
+   Some simple analysis showed that more than 99% of the jump
+   threading opportunities are for blocks with less than 15
+   statements.  So we can get the benefits of jump threading
+   without excessive code bloat for pathological cases with the
+   throttle set at 15 statements.  */
+DEFPARAM (PARAM_MAX_JUMP_THREAD_DUPLICATION_STMTS,
+         "max-jump-thread-duplication-stmts",
+          "Maximum number of statements allowed in a block that needs to be duplicated when threading jumps",
+         15, 0, 0)
+   
 /*
 Local variables:
 mode:c
index b37df7797f888fcf6a526518ef4e8302ed8ae738..cb5eeb03a2f28cf6b8a80730a1a55bf7c6c41eec 100644 (file)
@@ -42,6 +42,7 @@ Boston, MA 02110-1301, USA.  */
 #include "tree-pass.h"
 #include "tree-ssa-propagate.h"
 #include "langhooks.h"
+#include "params.h"
 
 /* This file implements optimizations on the dominator tree.  */
 
@@ -608,6 +609,9 @@ thread_across_edge (struct dom_walk_data *walk_data, edge e)
   block_stmt_iterator bsi;
   tree stmt = NULL;
   tree phi;
+  int stmt_count = 0;
+  int max_stmt_count;
+
 
   /* If E->dest does not end with a conditional, then there is
      nothing to do.  */
@@ -637,6 +641,11 @@ thread_across_edge (struct dom_walk_data *walk_data, edge e)
       tree src = PHI_ARG_DEF_FROM_EDGE (phi, e);
       tree dst = PHI_RESULT (phi);
 
+      /* Do not include virtual PHIs in our statement count as
+        they never generate code.  */
+      if (is_gimple_reg (dst))
+       stmt_count++;
+
       /* If the desired argument is not the same as this PHI's result 
         and it is set by a PHI in E->dest, then we can not thread
         through E->dest.  */
@@ -664,6 +673,7 @@ thread_across_edge (struct dom_walk_data *walk_data, edge e)
      Failure to simplify into the form above merely means that the
      statement provides no equivalences to help simplify later
      statements.  This does not prevent threading through E->dest.  */
+  max_stmt_count = PARAM_VALUE (PARAM_MAX_JUMP_THREAD_DUPLICATION_STMTS);
   for (bsi = bsi_start (e->dest); ! bsi_end_p (bsi); bsi_next (&bsi))
     {
       tree cached_lhs = NULL;
@@ -674,6 +684,12 @@ thread_across_edge (struct dom_walk_data *walk_data, edge e)
       if (IS_EMPTY_STMT (stmt) || TREE_CODE (stmt) == LABEL_EXPR)
        continue;
 
+      /* If duplicating this block is going to cause too much code
+        expansion, then do not thread through this block.  */
+      stmt_count++;
+      if (stmt_count > max_stmt_count)
+       return;
+
       /* Safely handle threading across loop backedges.  This is
         over conservative, but still allows us to capture the
         majority of the cases where we can thread across a loop