diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a13d96b848d..e0f89586ba9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2010-11-10 Richard Guenther + + PR tree-optimization/44964 + * ipa-inline.c (cgraph_flatten): Check that SSA form matches. + 2010-11-10 Martin Jambor PR tree-optimization/46351 diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 0072d61bfc3..61fc6b9992e 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 31d31d94067..92a850909a5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-11-10 Richard Guenther + + PR tree-optimization/44964 + * gcc.dg/pr44964.c: New testcase. + 2010-11-10 Eric Botcazou * 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 index 00000000000..1df1bde0703 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr44964.c @@ -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 (); +} +