[PATCH] Fix tail-merging -fcompare-debug failures (PR debug/52048)
Jakub Jelinek
jakub@redhat.com
Mon Jan 30 13:35:00 GMT 2012
Hi!
local_def in tail merging returned different results depending on
if there are any debug uses in other bbs or not.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?
2012-01-30 Jakub Jelinek <jakub@redhat.com>
PR debug/52048
* tree-ssa-tail-merge.c (local_def): Ignore debug uses.
* g++.dg/other/pr52048.C: New test.
--- gcc/tree-ssa-tail-merge.c.jj 2012-01-20 12:35:16.000000000 +0100
+++ gcc/tree-ssa-tail-merge.c 2012-01-30 09:23:05.392367800 +0100
@@ -371,6 +371,8 @@ local_def (tree val)
res = true;
FOR_EACH_IMM_USE_STMT (stmt, iter, val)
{
+ if (is_gimple_debug (stmt))
+ continue;
bb = gimple_bb (stmt);
if (bb == def_bb)
continue;
--- gcc/testsuite/g++.dg/other/pr52048.C.jj 2012-01-30 09:59:53.570759458 +0100
+++ gcc/testsuite/g++.dg/other/pr52048.C 2012-01-30 09:59:12.000000000 +0100
@@ -0,0 +1,79 @@
+// PR debug/52048
+// { dg-do compile }
+// { dg-options "-fcompare-debug -fnon-call-exceptions -fno-tree-dominator-opts -O2" }
+
+template <typename T> struct A;
+template <typename T>
+struct A <T *>
+{
+ typedef T &a;
+};
+template <typename T>
+struct B
+{
+ typedef typename A <T>::a a;
+ a operator *() {}
+};
+template <typename T, typename U>
+bool operator != (B <T>, B <U>)
+{
+}
+template <typename T>
+struct C
+{
+ typedef T *c;
+ template <typename>
+ struct D { typedef C d; };
+};
+template <typename T, typename U> struct E
+{
+ typedef typename U::template D <T>::d e;
+};
+template <typename T, typename U = C <T> >
+struct F
+{
+ typedef E <T, U> b;
+ typedef typename b::e e;
+ typedef typename e::c c;
+ typedef B <c> i;
+ i begin ();
+ i end ();
+};
+class G;
+class H;
+struct I
+{
+ void *i;
+ template <typename T> T foo ();
+};
+struct J : public I
+{
+ virtual bool bar ();
+};
+class K {};
+struct L
+{
+ bool baz () {}
+};
+struct M
+{
+ K m1 (K);
+ K m2 (H *) {}
+};
+struct N : J
+{
+ bool bar (G &);
+};
+bool
+N::bar (G &)
+{
+ M m = foo <M> ();
+ F <H *> f;
+ for (F <H *>::i I = f.begin (), E = f.end (); I != E;)
+ {
+ H *h = *I;
+ L l;
+ if (l.baz ())
+ m.m1 (m.m2 (h));
+ }
+}
Jakub
More information about the Gcc-patches
mailing list