The following changes the percentage that determines how many stmts are allowed for backwards jump threading from 50 to 54, enabling the missed jump threading observed in PR109893.
Bootstrapped and tested on x86_64-unknown-linux-gnu. It seems that at least backward threading is prone to profile mismatches, I've altered two testcases to deal with new ones to pop up (definitely latent issues). OK? PR tree-optimization/109893 * params.opt (fsm-scale-path-stmts): Change from 50 to 54. * gcc.dg/tree-ssa/pr109893.c: New testcase. * gcc.dg/tree-prof/cmpsf-1.c: XFAIL. * gcc.dg/tree-ssa/pr109893.c: Remove scan on no profile mismatches. --- gcc/params.opt | 2 +- gcc/testsuite/gcc.dg/tree-prof/cmpsf-1.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr109893.c | 33 ++++++++++++++++++++++++ gcc/testsuite/gcc.dg/vect/vect-117.c | 2 -- 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr109893.c diff --git a/gcc/params.opt b/gcc/params.opt index 0a1dfb46dd1..fed9d6e1826 100644 --- a/gcc/params.opt +++ b/gcc/params.opt @@ -143,7 +143,7 @@ Common Joined UInteger Var(param_file_cache_lines) Init(0) Param Max number of lines to index into file cache. When 0 this is automatically sized. -param=fsm-scale-path-stmts= -Common Joined UInteger Var(param_fsm_scale_path_stmts) Init(50) IntegerRange(1, 100) Param Optimization +Common Joined UInteger Var(param_fsm_scale_path_stmts) Init(54) IntegerRange(1, 100) Param Optimization Percentage of max-jump-thread-duplication-stmts to allow for the number of statements in a threading path crossing a loop backedge. -param=fully-pipelined-fma= diff --git a/gcc/testsuite/gcc.dg/tree-prof/cmpsf-1.c b/gcc/testsuite/gcc.dg/tree-prof/cmpsf-1.c index 537d15d4bfa..696f459e605 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/cmpsf-1.c +++ b/gcc/testsuite/gcc.dg/tree-prof/cmpsf-1.c @@ -181,4 +181,4 @@ main (void) exit (0); } -/* { dg-final-use-not-autofdo { scan-tree-dump-not "Invalid sum" "dom2" } } */ +/* { dg-final-use-not-autofdo { scan-tree-dump-not "Invalid sum" "dom2" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr109893.c b/gcc/testsuite/gcc.dg/tree-ssa/pr109893.c new file mode 100644 index 00000000000..5c98664df72 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr109893.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dom2" } */ + +void foo(void); +void bar(void); +static char a; +static int b, e, f; +static int *c = &b, *g; +int main() { + int *j = 0; + if (a) { + g = 0; + if (c) + bar(); + } else { + j = &e; + c = 0; + } + if (c == &f == b || c == &e) + ; + else + __builtin_unreachable(); + if (g || e) { + if (j == &e || j == 0) + ; + else + foo(); + } + a = 4; +} + +/* Jump threading in thread1 should enable to elide the call to foo. */ +/* { dg-final { scan-tree-dump-not "foo" "dom2" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-117.c b/gcc/testsuite/gcc.dg/vect/vect-117.c index 4755e39f951..ddbf104cfbe 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-117.c +++ b/gcc/testsuite/gcc.dg/vect/vect-117.c @@ -60,5 +60,3 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 0 "vect" } } */ - -/* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" { target { lp64 } } } } */ -- 2.43.0