[Patch] Improving jump-thread pass for PR 54742

Sebastian Pop sebpop@gmail.com
Sat Dec 6 13:47:00 GMT 2014


Jeff Law wrote:
> OK to commit.  Thanks for your patience.
> 
> Can you follow-up with a change which throttles this optimization
> when -Os is in effect.  You can check optimize_function_for_size_p
> (cfun) and simply avoid the backward traversal or you could allow it
> in that case if the amount of copying is suitably small.  Your call.

I think it does not make sense to duplicate paths at -Os: I disabled the FSM
jump-threading when optimizing for size like this.

diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index 29b20c8..ce70311 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -1335,8 +1335,9 @@ thread_through_normal_block (edge e,
          return 1;
        }
 
       if (!flag_expensive_optimizations
+         || optimize_function_for_size_p (cfun)
          || TREE_CODE (cond) != SSA_NAME
          || e->dest->loop_father != e->src->loop_father
          || loop_depth (e->dest->loop_father) == 0)
        return 0;

I will regstrap and commit the attached patch.

Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-extend-jump-thread-for-finite-state-automata.patch
Type: text/x-diff
Size: 27514 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20141206/5c5bed2b/attachment.bin>


More information about the Gcc-patches mailing list