summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-04-19 16:29:45 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-04-19 16:29:45 +0000
commit8ab5d9f0ed21a4d60a98ce2c786273c549131bfb (patch)
tree1de2da644583b6c767a87c734aac4c9776597d78
parenta0dd857296f7eda64ea0a2d515c9730a7fc74ef1 (diff)
downloadgcc-8ab5d9f0ed21a4d60a98ce2c786273c549131bfb.tar.gz
PR debug/80436
* tree-ssa-loop-manip.c (find_uses_to_rename_def): Ignore debug uses. * g++.dg/opt/pr80436.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@247000 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/opt/pr80436.C42
-rw-r--r--gcc/tree-ssa-loop-manip.c3
4 files changed, 55 insertions, 0 deletions
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 <jakub@redhat.com>
+
+ PR debug/80436
+ * tree-ssa-loop-manip.c (find_uses_to_rename_def): Ignore debug uses.
+
2017-04-19 Georg-Johann Lay <avr@gjlay.de>
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 <jakub@redhat.com>
+
+ PR debug/80436
+ * g++.dg/opt/pr80436.C: New test.
+
2017-04-19 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
* 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;