From 48d811eb1cbcf8176c769a8f7f227892b9949619 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 19 Apr 2017 18:29:45 +0200 Subject: [PATCH] re PR debug/80436 (-fcompare-debug failure) PR debug/80436 * tree-ssa-loop-manip.c (find_uses_to_rename_def): Ignore debug uses. * g++.dg/opt/pr80436.C: New test. From-SVN: r247000 --- gcc/ChangeLog | 5 ++++ gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/g++.dg/opt/pr80436.C | 42 ++++++++++++++++++++++++++++++ gcc/tree-ssa-loop-manip.c | 3 +++ 4 files changed, 55 insertions(+) create mode 100644 gcc/testsuite/g++.dg/opt/pr80436.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1995cd536b0..32af94d1b75 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-04-19 Jakub Jelinek + + PR debug/80436 + * tree-ssa-loop-manip.c (find_uses_to_rename_def): Ignore debug uses. + 2017-04-19 Georg-Johann Lay PR target/80462 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a6c392e6483..113506b6264 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-04-19 Jakub Jelinek + + PR debug/80436 + * g++.dg/opt/pr80436.C: New test. + 2017-04-19 Senthil Kumar Selvaraj * gcc.dg/torture/pr80341.c: Require int32plus. diff --git a/gcc/testsuite/g++.dg/opt/pr80436.C b/gcc/testsuite/g++.dg/opt/pr80436.C new file mode 100644 index 00000000000..b5879bf813d --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr80436.C @@ -0,0 +1,42 @@ +// PR debug/80436 +// { dg-do compile { target c++11 } } +// { dg-options "-O3 -fcompare-debug" } + +void fn (...); +void foo (int, int, int); +struct { int elt1; int bits; } *a; +int b, d; + +int +bar (unsigned *x) +{ + if (0) + next_bit: + return 1; + while (1) + { + if (b) + if (a->bits) + goto next_bit; + *x = b; + if (a->elt1) + return 0; + a = 0; + } +} + +enum { C0, C1 } *c; + +void +baz () +{ + int e, m = d; + for (; e < m; e++) + { + if (e < 0) + foo (0, 0, c[e]); + unsigned f; + for (; bar (&f);) + fn (f); + } +} diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index 22c832ae1e1..70d1f8444a4 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -494,6 +494,9 @@ find_uses_to_rename_def (tree def, bitmap *use_blocks, bitmap need_phis) FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def) { + if (is_gimple_debug (use_stmt)) + continue; + basic_block use_bb = gimple_bb (use_stmt); use_operand_p use_p; -- 2.30.2