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/torture/pr67769.c | 23 | ||||
-rw-r--r-- | gcc/tree-ssa-phiopt.c | 4 |
4 files changed, 40 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 06c9a298..c9f987e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-10-01 Marek Polacek <polacek@redhat.com> + + PR tree-optimization/67769 + * tree-ssa-phiopt.c (conditional_replacement): Call + reset_flow_sensitive_info_in_bb. + (minmax_replacement): Likewise. + (abs_replacement): Likewise. + 2015-10-01 Nathan Sidwell <nathan@codesourcery.com> * builtins.c: Don't include gomp-constants.h. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4b5d147..1d4713d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-10-01 Marek Polacek <polacek@redhat.com> + + PR tree-optimization/67769 + * gcc.dg/torture/pr67769.c: New test. + 2015-10-01 Uros Bizjak <ubizjak@gmail.com> * gcc.dg/lto/pr55113_0.c: Skip on all x86 targets. diff --git a/gcc/testsuite/gcc.dg/torture/pr67769.c b/gcc/testsuite/gcc.dg/torture/pr67769.c new file mode 100644 index 0000000..c1d17c3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr67769.c @@ -0,0 +1,23 @@ +/* { dg-do run } */ + +static int +clamp (int x, int lo, int hi) +{ + return (x < lo) ? lo : ((x > hi) ? hi : x); +} + +__attribute__ ((noinline)) +short +foo (int N) +{ + short value = clamp (N, 0, 16); + return value; +} + +int +main () +{ + if (foo (-5) != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 37fdf28..697836a 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -646,6 +646,7 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb, } replace_phi_edge_with_variable (cond_bb, e1, phi, new_var); + reset_flow_sensitive_info_in_bb (cond_bb); /* Note that we optimized this PHI. */ return true; @@ -1284,6 +1285,8 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb, gsi_insert_before (&gsi, new_stmt, GSI_NEW_STMT); replace_phi_edge_with_variable (cond_bb, e1, phi, result); + reset_flow_sensitive_info_in_bb (cond_bb); + return true; } @@ -1402,6 +1405,7 @@ abs_replacement (basic_block cond_bb, basic_block middle_bb, } replace_phi_edge_with_variable (cond_bb, e1, phi, result); + reset_flow_sensitive_info_in_bb (cond_bb); /* Note that we optimized this PHI. */ return true; |