re PR tree-optimization/42878 ("-fcompare-debug failure" at -O1 (2))
authorRichard Guenther <rguenther@suse.de>
Wed, 27 Jan 2010 16:00:31 +0000 (16:00 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 27 Jan 2010 16:00:31 +0000 (16:00 +0000)
2010-01-27  Richard Guenther  <rguenther@suse.de>

PR middle-end/42878
* tree-inline.c (remap_decl): Delay remapping of SSA name
default definitions until we need them.

* gcc.dg/torture/pr42878-1.c: New testcase.
* gcc.dg/torture/pr42878-2.c: Likewise.

From-SVN: r156291

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr42878-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr42878-2.c [new file with mode: 0644]
gcc/tree-inline.c

index 290b3544085f586594453c0f14970305cd214ad9..41f7bad4b1346e02018c2561b0fd9ed76f0b37df 100644 (file)
@@ -1,3 +1,9 @@
+2010-01-27  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/42878
+       * tree-inline.c (remap_decl): Delay remapping of SSA name
+       default definitions until we need them.
+
 2010-01-27  Jakub Jelinek  <jakub@redhat.com>
 
        * config/rs6000/rs6000.c (TARGET_DELEGITIMIZE_ADDRESS): Redefine.
index fd63e1b5f3c714303b88cb285a71a6786fe982d6..ef9940e3fa9416ec9354c95f6d9233a03dc850b5 100644 (file)
@@ -1,3 +1,9 @@
+2010-01-27  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/42878
+       * gcc.dg/torture/pr42878-1.c: New testcase.
+       * gcc.dg/torture/pr42878-2.c: Likewise.
+
 2010-01-27  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/42874
diff --git a/gcc/testsuite/gcc.dg/torture/pr42878-1.c b/gcc/testsuite/gcc.dg/torture/pr42878-1.c
new file mode 100644 (file)
index 0000000..8c21f0f
--- /dev/null
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-fcompare-debug" } */
+
+struct S {
+  int i;
+};
+
+extern struct S *e1(void);
+extern int e2(int i);
+
+static inline void f1()
+{
+  int i;
+  struct S *s;
+  for (i = 0; i < 10; i++)
+    s = e1();
+  e2(s->i);
+}
+
+static inline void f2(int i)
+{
+  int j = j;
+  j = e2(i);
+}
+
+void foo(int i)
+{
+  f1();
+  f2(i);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr42878-2.c b/gcc/testsuite/gcc.dg/torture/pr42878-2.c
new file mode 100644 (file)
index 0000000..67e413a
--- /dev/null
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-fcompare-debug" } */
+
+extern void error(void) __attribute__((noreturn));
+
+struct S {
+  struct S *s;
+};
+
+static inline unsigned char f2()
+{
+  error();
+}
+
+static inline void f1()
+{
+  int builtin_optab;
+  if (!f2() && builtin_optab)
+    error();
+}
+
+extern void f4(struct S *s);
+
+static inline void f3(struct S *s)
+{
+  f4(s->s->s);
+}
+
+void expand_builtin(struct S *s, int cond)
+{
+  if (cond)
+    f1();
+  f3(s);
+}
index 815d88af06660bef3bdc287b6341239c4d7aea01..9c560b1056c7d491d15ddaab015380b1ed26189e 100644 (file)
@@ -311,17 +311,7 @@ remap_decl (tree decl, copy_body_data *id)
          && (TREE_CODE (t) == VAR_DECL
              || TREE_CODE (t) == RESULT_DECL || TREE_CODE (t) == PARM_DECL))
        {
-          tree def = gimple_default_def (id->src_cfun, decl);
          get_var_ann (t);
-         if (TREE_CODE (decl) != PARM_DECL && def)
-           {
-             tree map = remap_ssa_name (def, id);
-             /* Watch out RESULT_DECLs whose SSA names map directly
-                to them.  */
-             if (TREE_CODE (map) == SSA_NAME
-                 && gimple_nop_p (SSA_NAME_DEF_STMT (map)))
-               set_default_def (t, map);
-           }
          add_referenced_var (t);
        }
       return t;