On Sun, Aug 07, 2016 at 10:30:48AM -0700, Andrew Pinski wrote: > On Mon, Jun 6, 2016 at 3:19 AM, Jan Hubicka <hubi...@ucw.cz> wrote: > > Hi, > > while looking into profile mismatches introduced by the backward threading > > pass > > I noticed that the heuristics seems quite simplistics. First it should be > > profile sensitive and disallow duplication when optimizing cold paths. > > Second > > it should use estimate_num_insns because gimple statement count is not > > really > > very realistic estimate of final code size effect and third there seems to > > be > > no reason to disable the pass for functions optimized for size. > > > > If we block duplication for more than 1 insns for size optimized paths the > > pass > > is able to do majority of threading decisions that are for free and improve > > codegen. > > The code size benefit was between 0.5% to 2.7% on testcases I tried > > (tramp3d, > > GCC modules, xlanancbmk and some other stuff around my hd). > > > > Bootstrapped/regtested x86_64-linux, seems sane? > > > > The pass should also avoid calling cleanup_cfg when no trheading was done > > and i do not see why it is guarded by expensive_optimizations. What are the > > main compile time complexity limitations? > > This patch caused a huge regression (~11%) on coremarks on ThunderX. > I assume other targets too. > Basically it looks like the path is no longer thread jumped.
This also caused: FAIL: gcc.dg/tree-ssa/pr69270-3.c scan-tree-dump-times uncprop1 ", 1" 4 Failures: gcc.dg/tree-ssa/pr69270-3.c Bisected to: Author: hubicka Date: Sun Aug 7 10:50:16 2016 +0000 * tree-ssa-threadbackward.c: Include tree-inline.h (profitable_jump_thread_path): Use estimate_num_insns to estimate size of copied block; for cold paths reduce duplication. (find_jump_threads_backwards): Remove redundant tests. (pass_thread_jumps::gate): Enable for -Os. * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Update testcase. svn+ssh://gcc.gnu.org/svn/gcc/trunk@239219 On my aarch64-none-linux-gnu and x86_64-none-linux-gnu automatic bisect robots. Thanks, James