Need help with fixing this two year old backend bug in mainline.

Jim Wilson wilson@specifixinc.com
Tue Sep 23 04:09:00 GMT 2003


Carlo Wood wrote:
> I am trying to make a start with PR 10003,
> which 4431 and 12319 marked as 'duplicate'.

> +       scope_to_insns_finalize ();
> Unfortunately, these functions are gone in 3.4.

I think these are gone because block info is now inside the insn rtx. 
Thus there is no longer any need to put block info in an external array 
and then sort it to match the insn stream.  The reason for the sort is 
to account for effects of things like instruction scheduling, but now 
that the block info gets scheduled along with the instructions, there is 
no longer any need for an extra sort.

This probably fixes the problem as a side-effect by moving (or 
creating?) a block note for the inlined function after the prologue.

Note that the prologue does not get emitted until after reload.  We 
can't emit it until then because we don't know which registers to save, 
and the size of the frame until then.

I am guessing that the problem is one or both of two problems:
1) When the prologue is inserted by thread_prologue_and_epilogue_insns, 
and the first block of the function is empty, it gets put in the wrong 
place.  It is inserted in the first block of the inlined function 
instead of before it, into the empty first block of the function.
2) We are too eagerly optimizing away empty blocks before the prologue 
gets inserted.  We should preserve an empty block to hold the prologue 
until after reload, to make sure that thread_prologue_and_epilogue_insns 
has a place to put the instructions it emits.

Exactly how to fix this depends on how the cfg routines are supposed to 
work.

I don't think this is the same problem as 4435, as that is apparently a 
scheduler/debug interaction problem, and the cfg stuff didn't exist 3 
years ago.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc-bugs mailing list