This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, x86, 63534] Fix '-p' profile for 32 bit PIC mode
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Evgeny Stupachenko <evstupac at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jeff Law <law at redhat dot com>, Uros Bizjak <ubizjak at gmail dot com>, vmakarov <vmakarov at redhat dot com>
- Date: Tue, 28 Oct 2014 19:19:46 +0100
- Subject: Re: [PATCH, x86, 63534] Fix '-p' profile for 32 bit PIC mode
- Authentication-results: sourceware.org; auth=none
- References: <CAOvf_xwJ85txuJyEYw99A+FV0k6y7VS2a34zaG0xLOX=+5jXDg at mail dot gmail dot com> <20141017143800 dot GB10376 at tucnak dot redhat dot com> <CAOvf_xxG8pbtr=0v3scZTJVsNpu5Sgkjz9K6W+S8bbEaGPRjig at mail dot gmail dot com> <20141024142941 dot GE10376 at tucnak dot redhat dot com> <CAOvf_xxfh+VTN3sBvJdP6r+u1yGPdWzzfRQ_CGz1bJLHzO+jDg at mail dot gmail dot com> <20141024155044 dot GI10376 at tucnak dot redhat dot com> <CAOvf_xzJTmoi=MOa9g65zqhqRfHSG59C_bqUso-CeV9B9SUQeg at mail dot gmail dot com> <20141028133619 dot GK10376 at tucnak dot redhat dot com> <CAOvf_xxNsx1w_Dd087HyAikqkNtd9EFma-xGkAfBPhsH6QB0bg at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Oct 28, 2014 at 06:28:29PM +0300, Evgeny Stupachenko wrote:
> +/* Delete SET_GOT right after entry block if it is allocated to reg. */
> +
> +static void
> +ix86_elim_entry_set_got (rtx reg)
> +{
> + basic_block bb = ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb;
> + rtx_insn *c_insn;
> + FOR_BB_INSNS (bb, c_insn)
> + if (GET_CODE (c_insn) != NOTE)
> + break;
This might result in -fcompare-debug failure, if there is
a DEBUG_INSN before the UNSPEC_SET_GOT. Also, if the first bb
contains only NOTE insns, you'd crash.
I'd use instead:
rtx_insn *c_insn = BB_HEAD (bb);
if (!NONDEBUG_INSN_P (c_insn))
c_insn = next_nonnote_nondebug_insn (c_insn);
if (c_insn && NONJUMP_INSN_P (c_insn))
or so.
> + if (NONJUMP_INSN_P (c_insn))
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/mcount_pic.c
> @@ -0,0 +1,13 @@
> +/* Test check correct mcount generation. */
> +/* { dg-do run } */
> +/* { dg-require-effective-target ia32 } */
> +/* { dg-options "-O2 -fpic -p -save-temps" } */
Please put the PR also in the testcase comment.
And, -fpic needs to be guarded by { target fpic }, though
as get_pc_thunk will not appear in non-pic code, I think
you want /* { dg-do run { target fpic } } */.
Otherwise LGTM.
Jakub
- References:
- [PATCH, x86, 63534] Fix '-p' profile for 32 bit PIC mode
- Re: [PATCH, x86, 63534] Fix '-p' profile for 32 bit PIC mode
- Re: [PATCH, x86, 63534] Fix '-p' profile for 32 bit PIC mode
- Re: [PATCH, x86, 63534] Fix '-p' profile for 32 bit PIC mode
- Re: [PATCH, x86, 63534] Fix '-p' profile for 32 bit PIC mode
- Re: [PATCH, x86, 63534] Fix '-p' profile for 32 bit PIC mode
- Re: [PATCH, x86, 63534] Fix '-p' profile for 32 bit PIC mode
- Re: [PATCH, x86, 63534] Fix '-p' profile for 32 bit PIC mode
- Re: [PATCH, x86, 63534] Fix '-p' profile for 32 bit PIC mode