This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -fnon-call-exceptions + -fprofile-arcs on x86
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: Eric Botcazou <ebotcazou at act-europe dot fr>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 10 May 2004 17:02:06 +0100
- Subject: Re: -fnon-call-exceptions + -fprofile-arcs on x86
- Organization: Codesourcery LLC
- References: <200405101350.02551.ebotcazou@act-europe.fr>
Eric Botcazou wrote:
Hi,
We ran into a problem with -fnon-call-exceptions + -fprofile-arcs on x86.
Now -fnon-call-exception is the default for Ada, so the problem is already
present with -fprofile-arcs for the Ada compiler (and further exacerbated by
-fstack-check).
-fprofile-arcs needs to add increment insns on some edges of the CFG. The
'add' insns on x86 clobber the condition code register so -fprofile-arcs
wreaks havoc when the condition code register is live on the edges it adds
insns on.
It's possible (and very easy with -fstack-check) to have the condition code
register live on edges with -fnon-call-exceptions: a compare-and-jump
construct whose operands are trapping MEMs is sufficient. This leads to
wrong code because the compare is eventually deleted.
Now to the question: is this fixable in profile.c?
I don't see how, one of the two edges must be counted. The exceptional
edge cannot be, because there's no actual flow there. So profile must
add the incrementing code on the fall through edge.
> If no, would a patch that
prevents the middle-end from generating compare-and-jump constructs that
span two basic blocks be acceptable?
I guess what needs to happen is that (when -fprofile-arcs is on) cc0 is
clobbered at the end of every block.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk