[PATCH] With -fno-early-inlining -finline-functions-called-once don't inline functions if there is argument type mismatch (PR tree-optimization/48063)
Jakub Jelinek
jakub@redhat.com
Thu Mar 10 22:46:00 GMT 2011
Hi!
ipa-inline.c apparently in all spots but one where it checks
call_stmt_cannot_inline_p also checks tree_can_inline_p. With
-fno-early-inlining tree_can_inline_p won't be called earlier and thus
code to attempt to inline functions called once doesn't ever call
it to notice there is an argument mismatch.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux.
Ok for trunk?
2011-03-10 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/48063
* ipa-inline.c (cgraph_decide_inlining): Don't try to
inline functions called once if !tree_can_inline_p (node->callers).
* gcc.dg/torture/pr48063.c: New test.
--- gcc/ipa-inline.c.jj 2011-03-03 09:11:51.000000000 +0100
+++ gcc/ipa-inline.c 2011-03-10 20:03:41.000000000 +0100
@@ -1498,6 +1498,7 @@ cgraph_decide_inlining (void)
&& node->callers->caller != node
&& node->callers->caller->global.inlined_to != node
&& !node->callers->call_stmt_cannot_inline_p
+ && tree_can_inline_p (node->callers)
&& !DECL_EXTERNAL (node->decl))
{
cgraph_inline_failed_t reason;
--- gcc/testsuite/gcc.dg/torture/pr48063.c.jj 2011-03-10 20:05:59.000000000 +0100
+++ gcc/testsuite/gcc.dg/torture/pr48063.c 2011-03-10 20:05:43.000000000 +0100
@@ -0,0 +1,19 @@
+/* PR tree-optimization/48063 */
+/* { dg-do compile } */
+/* { dg-options "-fno-early-inlining" } */
+
+extern void abort (void);
+static void bar ();
+
+void
+foo ()
+{
+ bar (1);
+}
+
+static void
+bar (double i)
+{
+ if (i)
+ abort ();
+}
Jakub
More information about the Gcc-patches
mailing list