From 5129b43be675171c2e4742ae4b1e073249314818 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 14 Nov 2016 10:33:15 +0000 Subject: [PATCH] re PR tree-optimization/78312 (wrong code due to ssa-backprop) 2016-11-14 Richard Biener PR tree-optimization/78312 * gimple-ssa-backprop.c (backprop::prepare_change): Reset flow-sensitive info. * gcc.dg/torture/pr78312.c: New testcase. From-SVN: r242380 --- gcc/ChangeLog | 6 ++++++ gcc/gimple-ssa-backprop.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr78312.c | 23 +++++++++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr78312.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5c53b9bf271..a4f6a34f8f1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-11-14 Richard Biener + + PR tree-optimization/78312 + * gimple-ssa-backprop.c (backprop::prepare_change): Reset + flow-sensitive info. + 2016-11-14 Georg-Johann Lay PR target/78093 diff --git a/gcc/gimple-ssa-backprop.c b/gcc/gimple-ssa-backprop.c index 53349e89658..6ef221817f9 100644 --- a/gcc/gimple-ssa-backprop.c +++ b/gcc/gimple-ssa-backprop.c @@ -728,6 +728,7 @@ backprop::prepare_change (tree var) { if (MAY_HAVE_DEBUG_STMTS) insert_debug_temp_for_var_def (NULL, var); + reset_flow_sensitive_info (var); } /* STMT has been changed. Give the fold machinery a chance to simplify diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b87788eaf16..bf99ab981b9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-11-14 Richard Biener + + PR tree-optimization/78312 + * gcc.dg/torture/pr78312.c: New testcase. + 2016-11-14 Georg-Johann Lay PR target/78093 diff --git a/gcc/testsuite/gcc.dg/torture/pr78312.c b/gcc/testsuite/gcc.dg/torture/pr78312.c new file mode 100644 index 00000000000..470e5b2ea0a --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr78312.c @@ -0,0 +1,23 @@ +/* { dg-do run } */ + +typedef unsigned short u16; + +static u16 a; + +u16 __attribute__ ((noinline, noclone)) +foo (int p1) +{ + a = -(p1 > 0); + a *= 0 != a; + a *= (unsigned)a; + return a; +} + +int +main () +{ + u16 x = foo (1); + if (x != 1) + __builtin_abort(); + return 0; +} -- 2.30.2