diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr94211.c | 12 | ||||
-rw-r--r-- | gcc/tree-ssa-phiopt.c | 10 |
4 files changed, 30 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c91c73a..259d4ae 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2020-03-19 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/94211 + * tree-ssa-phiopt.c (value_replacement): Use estimate_num_insns_seq + instead of estimate_num_insns for bb_seq (middle_bb). Rename + emtpy_or_with_defined_p variable to empty_or_with_defined_p, adjust + all uses. + 2020-03-19 Richard Biener <rguenther@suse.de> PR ipa/94217 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e828b7f..58f2e7e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-03-19 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/94211 + * gcc.dg/pr94211.c: New test. + 2020-03-19 Richard Biener <rguenther@suse.de> PR middle-end/94216 diff --git a/gcc/testsuite/gcc.dg/pr94211.c b/gcc/testsuite/gcc.dg/pr94211.c new file mode 100644 index 0000000..3e160e4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr94211.c @@ -0,0 +1,12 @@ +/* PR tree-optimization/94211 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcompare-debug" } */ + +long +foo (long a, long b) +{ + if (__builtin_expect (b == 1, 1)) + return a; + int e = a + 1; + return a / b; +} diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 947143b..9693118 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -1056,7 +1056,7 @@ value_replacement (basic_block cond_bb, basic_block middle_bb, gimple *cond; edge true_edge, false_edge; enum tree_code code; - bool emtpy_or_with_defined_p = true; + bool empty_or_with_defined_p = true; /* If the type says honor signed zeros we cannot do this optimization. */ @@ -1075,7 +1075,7 @@ value_replacement (basic_block cond_bb, basic_block middle_bb, { if (gimple_code (stmt) != GIMPLE_PREDICT && gimple_code (stmt) != GIMPLE_NOP) - emtpy_or_with_defined_p = false; + empty_or_with_defined_p = false; continue; } /* Now try to adjust arg0 or arg1 according to the computation @@ -1085,7 +1085,7 @@ value_replacement (basic_block cond_bb, basic_block middle_bb, && jump_function_from_stmt (&arg0, stmt)) || (lhs == arg1 && jump_function_from_stmt (&arg1, stmt))) - emtpy_or_with_defined_p = false; + empty_or_with_defined_p = false; } cond = last_stmt (cond_bb); @@ -1137,7 +1137,7 @@ value_replacement (basic_block cond_bb, basic_block middle_bb, /* If the middle basic block was empty or is defining the PHI arguments and this is a single phi where the args are different for the edges e0 and e1 then we can remove the middle basic block. */ - if (emtpy_or_with_defined_p + if (empty_or_with_defined_p && single_non_singleton_phi_for_edges (phi_nodes (gimple_bb (phi)), e0, e1) == phi) { @@ -1255,7 +1255,7 @@ value_replacement (basic_block cond_bb, basic_block middle_bb, && profile_status_for_fn (cfun) != PROFILE_ABSENT && EDGE_PRED (middle_bb, 0)->probability < profile_probability::even () /* If assign is cheap, there is no point avoiding it. */ - && estimate_num_insns (bb_seq (middle_bb), &eni_time_weights) + && estimate_num_insns_seq (bb_seq (middle_bb), &eni_time_weights) >= 3 * estimate_num_insns (cond, &eni_time_weights)) return 0; |