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