This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Fix PR41440 bad edge insertion


On Thu, Oct 1, 2009 at 3:26 PM,  <andrewhutchinson@cox.net> wrote:
>
>
> The attach patch fixs problem with edge insertions being made in the wrong place if RTL pattern happens to use jump.
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41440
>
> The problem breaks cc0 targets during CSE. Non cc0 targets can equally get
> erroneous insertion made inside RTL expander loop pattern. These may or may not
> break.
> After discussion with Micael Matz, the preferred method is fix the problem at the point of
> RTL expansion. A block that ends with a jump created by RTL expander on an
> otherwise fallthru edge, is now padded with mov(r,r) NOP. Thus
> commit_one_edge_insertion() will no longer find and interpret this as a jump to
> successor causing the insertion point to be wrong.
>
> Ok for 4.5 Trunk?

Ok.

Thanks,
Richard.

> Regression tested on Rev15226 (20090927)
> Native configuration i686-pc-linux-gnu with no regression on C and C++ tests.
> Also
> Target is avr-unknown-none
> Host is i686-pc-linux-gnu
> Producing 28 less failure on C testsuite, no regressions.
>
> 2009-09-30 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
>
> PR middle-end/41440
> * cfgexpand.c (expand_gimple_basic_block): Append NOP to a fallthru,
> single successor block, ending with jump created by RTL expander.
>
> Index: cfgexpand.c
> ===================================================================
> --- cfgexpand.c(revision 152217)
> +++ cfgexpand.c(working copy)
> @@ -3165,6 +3165,18 @@
> }
> }
>
> + /* Expanded RTL can create a jump in the last instruction of block.
> + This later might be assumed to be a jump to successor and break edge insertion.
> + We need to insert dummy move to prevent this. PR41440. */
> + if (single_succ_p (bb)
> + && (single_succ_edge (bb)->flags & EDGE_FALLTHRU)
> + && (last = get_last_insn ())
> + && JUMP_P (last))
> + {
> + rtx dummy = gen_reg_rtx (SImode);
> + emit_insn_after_noloc (gen_move_insn (dummy, dummy), last, NULL);
> + }
> +
> do_pending_stack_adjust ();
>
> /* Find
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]