This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 225/236] Work towards NEXT_INSN/PREV_INSN requiring insns as their params
- From: David Malcolm <dmalcolm at redhat dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Jeff Law <law at redhat dot com>, Richard Henderson <rth at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 28 Aug 2014 20:47:17 -0400
- Subject: Re: [PATCH 225/236] Work towards NEXT_INSN/PREV_INSN requiring insns as their params
- Authentication-results: sourceware.org; auth=none
- References: <1407345815-14551-1-git-send-email-dmalcolm at redhat dot com> <1407345815-14551-226-git-send-email-dmalcolm at redhat dot com> <53F3BA30 dot 4050301 at redhat dot com> <1408484146 dot 2473 dot 128 dot camel at surprise> <53FB4743 dot 5030103 at redhat dot com> <1409073313 dot 24896 dot 42 dot camel at surprise> <CAMe9rOqCt0o3wj3QoLQg3Mp-fYL0-=10Ah5C-==UwDc0FtDRag at mail dot gmail dot com>
On Thu, 2014-08-28 at 17:08 -0700, H.J. Lu wrote:
> On Tue, Aug 26, 2014 at 10:15 AM, David Malcolm <dmalcolm@redhat.com> wrote:
> > On Mon, 2014-08-25 at 08:25 -0600, Jeff Law wrote:
> >> On 08/19/14 15:35, David Malcolm wrote:
> >> > On Tue, 2014-08-19 at 13:57 -0700, Richard Henderson wrote:
> >> >> On 08/06/2014 10:23 AM, David Malcolm wrote:
> >> >>> diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
> >> >>> index 59d633d..5e42a97 100644
> >> >>> --- a/gcc/cfgrtl.c
> >> >>> +++ b/gcc/cfgrtl.c
> >> >>> @@ -1604,6 +1604,7 @@ force_nonfallthru_and_redirect (edge e, basic_block target, rtx jump_label)
> >> >>>
> >> >>> if (EDGE_COUNT (e->src->succs) >= 2 || abnormal_edge_flags || asm_goto_edge)
> >> >>> {
> >> >>> + rtx_insn *note;
> >> >>> gcov_type count = e->count;
> >> >>> int probability = e->probability;
> >> >>> /* Create the new structures. */
> >> >>
> >> >> A new variable with no uses?
> >> >
> >> > This one is quite ugly: the pre-existing code has two locals named
> >> > "note", both of type rtx, with one shadowing the other. This patch
> >> > introduces a third, within the scope where the name "note" is used for
> >> > insns. In the other scopes the two other "note" variables are used for
> >> > find_reg_note. In each case, the name "note" is written to before use.
> >> >
> >> > So in my defense, the existing code already had shadowing of locals...
> >> > but I guess that's not much of a defense, and it would be better to
> >> > introduce a different name, and rename the uses in the appropriate
> >> > scope.
> >> If it's reasonable to do this now, then please do so. Else make it a
> >> follow-up item. I guess we should have had a list of follow-up items :-)
> >>
> >> jeff
> >
> > Attached is a revised version of #225, with the following changes:
> >
> > * fix for the above: avoid introducing a new shadow name "note" within
> > force_nonfallthru_and_redirect by introducing a new local rtx_insn *
> > "new_head" and renaming "note" to it in the appropriate places.
> >
> > * changed an as_a<> to a safe_as_a<> within
> > function.c:thread_prologue_and_epilogue_insns to fix a segfault seen
> > during an earlier bootstrap
> >
> > Successfully bootstrapped on x86_64 (Fedora 20), on top of the rest of
> > the patches leading up to it (including the revised ones for #220-#221
> > that rth recently approved).
> >
> > OK for trunk?
> > Dave
>
> One of your changes caused:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62300
Sorry about this; candidate patch attached; attempted bootstrap in
progress.
Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog (revision 214708)
+++ gcc/ChangeLog (working copy)
@@ -1,5 +1,12 @@
2014-08-28 David Malcolm <dmalcolm@redhat.com>
+ PR bootstrap/62300
+ * function.c (assign_parm_setup_reg): Remove erroneous checked
+ cast to rtx_insn * on result of gen_extend_insn in favor of
+ introducing a new local rtx "pat".
+
+2014-08-28 David Malcolm <dmalcolm@redhat.com>
+
* rtl.h (previous_insn): Strengthen param from rtx to rtx_insn *.
(next_insn): Likewise.
* emit-rtl.c (next_insn): Likewise.
Index: gcc/function.c
===================================================================
--- gcc/function.c (revision 214704)
+++ gcc/function.c (working copy)
@@ -3039,10 +3039,9 @@
}
else
t = op1;
- insn = as_a <rtx_insn *> (
- gen_extend_insn (op0, t, promoted_nominal_mode,
- data->passed_mode, unsignedp));
- emit_insn (insn);
+ rtx pat = gen_extend_insn (op0, t, promoted_nominal_mode,
+ data->passed_mode, unsignedp);
+ emit_insn (pat);
insns = get_insns ();
moved = true;