This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -fprofile-arcs overwriting return value of fn.
- From: Michael Matz <matz at kde dot org>
- To: Johannes Thoma <joe at mond dot at>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Thu, 25 Apr 2002 18:48:53 +0200 (MET DST)
- Subject: Re: -fprofile-arcs overwriting return value of fn.
Hi,
On Thu, 25 Apr 2002, Johannes Thoma wrote:
> I was experimenting with -fprofile-arcs on the new-reg-alloc branch.
> I found that on exit edges, it inserts insns for profilling after
> the ``use'' of the register holding the return value which can
> cause return values be overwritten:
I already fixed that in the process of merging HEAD and reg-alloc branch.
It's just not committed. I'm not sure you really want to test
-fprofile-arcs and friends on the current version of that branch, as it is
based on a fairly old version of gcc (that's why also the attempt of
merging ;) ), so the profile based optimizations may not work anyway.
> Did anybody else observe the above? Is someone already working on
> a patch?
In the meantime you can simply add the final use again, by adding locally
if (!INSN_P (get_last_insn ())
|| GET_CODE (PATTERN (get_last_insn ())) != USE)
{
rtx insn, last = get_last_insn ();
basic_block bb = BLOCK_FOR_INSN (last);
if (bb)
{
use_return_register ();
for (insn = get_last_insn (); insn != last; insn = PREV_INSN (insn))
set_block_for_insn (insn, bb);
if (last == bb->end)
bb->end = get_last_insn ();
}
}
at the begin of reg_alloc. I'm not sure, if I should be able to rely on
that final use for the allocator (in which case commit_edge_insertion has
to be fixed), or if I only can rely on the bitmap of live registers at the
begin of the EXIT_BLOCK. Currently I use the use ;)
Ciao,
Michael.