public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [lto] patch committed to fix calls and FUNCTION_DECLS
@ 2007-08-28 17:02 Kenneth Zadeck
  2007-08-28 17:05 ` Diego Novillo
  0 siblings, 1 reply; 3+ messages in thread
From: Kenneth Zadeck @ 2007-08-28 17:02 UTC (permalink / raw)
  To: Jim Blandy, Mark Mitchell, gcc-patches, William Maddox

Bill Maddox sent me the following test case:

=============
unsigned fact(unsigned x)
{
  if (x == 0)
    return 1;
  else
    return x * fact(x - 1);
}

int
main()
{
  (void)fact(5);  /* dont' bother to print */
  return 0;
}
=============
Which i have processed with the following two commands:
=============
./xgcc -flto -c -O2 test/test.c -o test/test.o
./lto1 -O2 test/test.o -o test/test.o.o
=============
This patch fixes the first two problems that you would hit if you tried
this set of commands.
I am working on the third.

kenny



2007-08-28  Kenneth Zadeck <zadeck@naturalbridge.com>

    * lto-function-out (output_expr_operand): Reorder the fields
    in the stream for CALL_EXPRs.
    (lto_static_init): Do not put out types for FUNCTION_DECLs.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [lto] patch committed to fix calls and FUNCTION_DECLS
  2007-08-28 17:02 [lto] patch committed to fix calls and FUNCTION_DECLS Kenneth Zadeck
@ 2007-08-28 17:05 ` Diego Novillo
  2007-08-28 17:45   ` Kenneth Zadeck
  0 siblings, 1 reply; 3+ messages in thread
From: Diego Novillo @ 2007-08-28 17:05 UTC (permalink / raw)
  To: Kenneth Zadeck; +Cc: Jim Blandy, Mark Mitchell, gcc-patches, William Maddox

On 8/28/07, Kenneth Zadeck <zadeck@naturalbridge.com> wrote:

> 2007-08-28  Kenneth Zadeck <zadeck@naturalbridge.com>
>
>     * lto-function-out (output_expr_operand): Reorder the fields
>     in the stream for CALL_EXPRs.
>     (lto_static_init): Do not put out types for FUNCTION_DECLs.

The patch is missing.  Also, could you describe what those problems
were?  It tends to be useful when doing archeology in the future.

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [lto] patch committed to fix calls and FUNCTION_DECLS
  2007-08-28 17:05 ` Diego Novillo
@ 2007-08-28 17:45   ` Kenneth Zadeck
  0 siblings, 0 replies; 3+ messages in thread
From: Kenneth Zadeck @ 2007-08-28 17:45 UTC (permalink / raw)
  To: Diego Novillo; +Cc: Jim Blandy, Mark Mitchell, gcc-patches, William Maddox

[-- Attachment #1: Type: text/plain, Size: 780 bytes --]

Diego Novillo wrote:
> On 8/28/07, Kenneth Zadeck <zadeck@naturalbridge.com> wrote:
>
>   
>> 2007-08-28  Kenneth Zadeck <zadeck@naturalbridge.com>
>>
>>     * lto-function-out (output_expr_operand): Reorder the fields
>>     in the stream for CALL_EXPRs.
>>     (lto_static_init): Do not put out types for FUNCTION_DECLs.
>>     
>
> The patch is missing.  Also, could you describe what those problems
> were?  It tends to be useful when doing archeology in the future.
>
> Thanks.
>   
Sorry,

The patch fixes two problems:

First, the order of the operands for CALL_EXPRs being output was not the
order that was expected when reading them back in.

Second, FUNCTION_DECLS were being serialized without a type but the
reader was expecting one.  They do not need a type. 

Kenny

[-- Attachment #2: postmerge7.diff --]
[-- Type: text/x-patch, Size: 1304 bytes --]

Index: lto-function-out.c
===================================================================
--- lto-function-out.c	(revision 127862)
+++ lto-function-out.c	(working copy)
@@ -1232,17 +1232,19 @@ output_expr_operand (struct output_block
       {
 	unsigned int count = TREE_INT_CST_LOW (TREE_OPERAND (expr, 0));
 	unsigned int i;
-	output_uleb128 (ob, count);
 
 	/* Operand 2 is the call chain.  */
 	if (TREE_OPERAND (expr, 2))
 	  {
 	    output_record_start (ob, expr, expr, LTO_call_expr1);
+	    output_uleb128 (ob, count);
 	    output_expr_operand (ob, TREE_OPERAND (expr, 2));
 	  }
 	else
-	  output_record_start (ob, expr, expr, LTO_call_expr0);
-
+	  {
+	    output_record_start (ob, expr, expr, LTO_call_expr0);
+	    output_uleb128 (ob, count);
+	  }
 	output_expr_operand (ob, TREE_OPERAND (expr, 1));
 	for (i = 3; i < count; i++)
 	  output_expr_operand (ob, TREE_OPERAND (expr, i));
@@ -1869,6 +1871,7 @@ lto_static_init (void)
   RESET_BIT (lto_types_needed_for, ASM_EXPR);
   RESET_BIT (lto_types_needed_for, CASE_LABEL_EXPR);
   RESET_BIT (lto_types_needed_for, FIELD_DECL);
+  RESET_BIT (lto_types_needed_for, FUNCTION_DECL);
   RESET_BIT (lto_types_needed_for, GIMPLE_MODIFY_STMT);
   RESET_BIT (lto_types_needed_for, LABEL_DECL);
   RESET_BIT (lto_types_needed_for, LABEL_EXPR);

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-28 17:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-28 17:02 [lto] patch committed to fix calls and FUNCTION_DECLS Kenneth Zadeck
2007-08-28 17:05 ` Diego Novillo
2007-08-28 17:45   ` Kenneth Zadeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).