From 32f2925a7a25093a09ebd8f8287d064838da6770 Mon Sep 17 00:00:00 2001 From: rguenth Date: Tue, 2 Feb 2016 12:39:36 +0000 Subject: 2016-02-02 Richard Biener PR tree-optimization/69606 * tree-ssa-math-opts.c (bswap_replace): Clear flow sensitive info on the result before moving a stmt. * gcc.dg/torture/pr69606.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233069 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr69606.c | 20 ++++++++++++++++++++ gcc/tree-ssa-math-opts.c | 2 ++ 4 files changed, 33 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr69606.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index be546dcdba1..05741331506 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-02-02 Richard Biener + + PR tree-optimization/69606 + * tree-ssa-math-opts.c (bswap_replace): Clear flow sensitive + info on the result before moving a stmt. + 2016-02-02 Yuri Rumyantsev PR middle-end/68542 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7f348ae05fc..9d89eee0ebb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-02-02 Richard Biener + + PR tree-optimization/69606 + * gcc.dg/torture/pr69606.c: New testcase. + 2016-02-02 Yuri Rumyantsev PR middle-end/68542 diff --git a/gcc/testsuite/gcc.dg/torture/pr69606.c b/gcc/testsuite/gcc.dg/torture/pr69606.c new file mode 100644 index 00000000000..84a0e1a6543 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr69606.c @@ -0,0 +1,20 @@ +/* { dg-do run } */ + +char a; +unsigned short b; +int c, d; +unsigned char e; + +int +main () +{ + int f = 1, g = ~a; + if (b > f) + { + e = b; + d = b | e; + g = 0; + } + c = 1 % g; + return 0; +} diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index abd77e76dce..3aa4a07435f 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -2622,6 +2622,8 @@ bswap_replace (gimple *cur_stmt, gimple *src_stmt, tree fndecl, /* Move cur_stmt just before one of the load of the original to ensure it has the same VUSE. See PR61517 for what could go wrong. */ + if (gimple_bb (cur_stmt) != gimple_bb (src_stmt)) + reset_flow_sensitive_info (gimple_assign_lhs (cur_stmt)); gsi_move_before (&gsi, &gsi_ins); gsi = gsi_for_stmt (cur_stmt); -- cgit v1.2.3