OSDN Git Service

PR tree-optimization/51865
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Jan 2012 11:12:53 +0000 (11:12 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Jan 2012 11:12:53 +0000 (11:12 +0000)
* tree-inline.c (tree_function_versioning): Call remap_decl
on DECL_RESULT whenever it has VOID_TYPE_P type.

* gcc.dg/pr51865.c: New test.

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

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

index 67c69aa..de68959 100644 (file)
@@ -1,3 +1,9 @@
+2012-01-16  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/51865
+       * tree-inline.c (tree_function_versioning): Call remap_decl
+       on DECL_RESULT whenever it has VOID_TYPE_P type.
+
 2012-01-15  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * config/mips/mips.c (mips16_build_call_stub): Don't use a stub
 2012-01-15  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * config/mips/mips.c (mips16_build_call_stub): Don't use a stub
index b5d9828..07e452c 100644 (file)
@@ -1,3 +1,8 @@
+2012-01-16  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/51865
+       * gcc.dg/pr51865.c: New test.
+
 2012-01-15  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * gcc.dg/tree-ssa/ssa-dom-thread-4.c: Expect 4 threaded edges for MIPS.
 2012-01-15  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * gcc.dg/tree-ssa/ssa-dom-thread-4.c: Expect 4 threaded edges for MIPS.
diff --git a/gcc/testsuite/gcc.dg/pr51865.c b/gcc/testsuite/gcc.dg/pr51865.c
new file mode 100644 (file)
index 0000000..9b4595c
--- /dev/null
@@ -0,0 +1,25 @@
+/* PR tree-optimization/51865 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fipa-pta" } */
+
+void fn (const char *, const char *) __attribute__ ((__noreturn__));
+int var;
+
+inline void
+foo (void)
+{
+  if (__builtin_expect (var != 0, 0))
+    fn ("a", "b");
+};
+
+void
+bar (void)
+{
+  foo ();
+};
+
+void
+baz (void)
+{
+  foo ();
+};
index a039890..ae773f6 100644 (file)
@@ -1,6 +1,6 @@
 /* Tree inlining.
 /* Tree inlining.
-   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
+   2012 Free Software Foundation, Inc.
    Contributed by Alexandre Oliva <aoliva@redhat.com>
 
 This file is part of GCC.
    Contributed by Alexandre Oliva <aoliva@redhat.com>
 
 This file is part of GCC.
@@ -5201,9 +5201,9 @@ tree_function_versioning (tree old_decl, tree new_decl,
     /* Add local vars.  */
     add_local_variables (DECL_STRUCT_FUNCTION (old_decl), cfun, &id, false);
 
     /* Add local vars.  */
     add_local_variables (DECL_STRUCT_FUNCTION (old_decl), cfun, &id, false);
 
-  if (VOID_TYPE_P (TREE_TYPE (DECL_RESULT (old_decl))))
+  if (DECL_RESULT (old_decl) == NULL_TREE)
     ;
     ;
-  else if (skip_return)
+  else if (skip_return && !VOID_TYPE_P (TREE_TYPE (DECL_RESULT (old_decl))))
     {
       DECL_RESULT (new_decl)
        = build_decl (DECL_SOURCE_LOCATION (DECL_RESULT (old_decl)),
     {
       DECL_RESULT (new_decl)
        = build_decl (DECL_SOURCE_LOCATION (DECL_RESULT (old_decl)),