OSDN Git Service

2010-11-10 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Nov 2010 16:05:03 +0000 (16:05 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Nov 2010 16:05:03 +0000 (16:05 +0000)
PR tree-optimization/44964
* ipa-inline.c (cgraph_flatten): Check that SSA form matches.

* gcc.dg/pr44964.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166543 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/ipa-inline.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr44964.c [new file with mode: 0644]

index a13d96b..e0f8958 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-10  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/44964
+       * ipa-inline.c (cgraph_flatten): Check that SSA form matches.
+
 2010-11-10  Martin Jambor  <mjambor@suse.cz>
 
        PR tree-optimization/46351
index 0072d61..61fc6b9 100644 (file)
@@ -1407,6 +1407,14 @@ cgraph_flatten (struct cgraph_node *node)
          continue;
        }
 
+      if (gimple_in_ssa_p (DECL_STRUCT_FUNCTION (node->decl))
+         != gimple_in_ssa_p (DECL_STRUCT_FUNCTION (e->callee->decl)))
+       {
+         if (dump_file)
+           fprintf (dump_file, "Not inlining: SSA form does not match.\n");
+         continue;
+       }
+
       /* Inline the edge and flatten the inline clone.  Avoid
          recursing through the original node if the node was cloned.  */
       if (dump_file)
index 31d31d9..92a8509 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-10  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/44964
+       * gcc.dg/pr44964.c: New testcase.
+
 2010-11-10  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/opt10.adb: Fix typo.
diff --git a/gcc/testsuite/gcc.dg/pr44964.c b/gcc/testsuite/gcc.dg/pr44964.c
new file mode 100644 (file)
index 0000000..1df1bde
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fkeep-inline-functions -O" } */
+
+static inline __attribute__ ((const))
+void baz (int i)
+{
+}
+
+static __attribute__ ((always_inline))
+inline __attribute__ ((flatten))
+void bar (void)
+{
+  baz (0);
+}
+
+void
+foo (void)
+{
+  bar ();
+}
+