This patch to the GCC interface to the Go frontend changes the final
step of the frontend to not always call gimplify_function_tree.  There
is no need for it, as the cgraphunit code will do that if required.
However, when we don't call gimplify_function_tree we do have to call
allocate_struct_function, unless it's already been called.  This small
change is to support cross-package inlining by avoiding an assertion
failure when we gimplify an inline function that is never used.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian


2018-10-31  Ian Lance Taylor  <i...@golang.org>

* go-gcc.cc (Gcc_backend::write_global_definitions): Don't call
gimplify_function_tree.  Instead call allocate_struct_function if
necessary.
Index: go-gcc.cc
===================================================================
--- go-gcc.cc   (revision 265697)
+++ go-gcc.cc   (working copy)
@@ -3246,7 +3246,8 @@ Gcc_backend::write_global_definitions(
       if (decl != error_mark_node)
         {
           go_preserve_from_gc(decl);
-          gimplify_function_tree(decl);
+         if (DECL_STRUCT_FUNCTION(decl) == NULL)
+           allocate_struct_function(decl, false);
           cgraph_node::finalize_function(decl, true);
 
           defs[i] = decl;

Reply via email to