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]

Re: Use of single_set() in loop_regs_update()



> > Hmmm, I believe that loop_regs_update is supposed to be passed either an
> > INSN or a SEQUENCE (with INSNs inside the SEQUENCE).
> >
> > Who is passing a raw SET to loop_regs_update?
>
> All values passed to loop_regs_update() seem to come directly from
> gen_sequence().  If the idea's to pass the insn instead, how about the
> patch below?  Bootstraps on i686 cygwin, make check-gcc shows no
> regressions.  record_base_value() gets called when expected.
>
> [snip patch which included the line
>    if (GET_CODE (PATTERN (insn)) == SEQUENCE)
> - oops!]

Well, the previous patch just swapped one untaken branch for another.
How about this? ;-) Tested in the same way, for what it's worth.

Please install if OK.

2001-03-16  Richard Sandiford  <rsandifo@redhat.com>

	* loop.c (loop_regs_update): Take the added insn as an extra argument.
	Pass the added insn to single_set() if the pattern isn't a SEQUENCE.
	(loop_iv_add_mult_emit_before): Pass it the added insn.
	(loop_iv_add_mult_sink): Likewise.
	(loop_iv_add_mult_hoist): Likewise.

Index: loop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/loop.c,v
retrieving revision 1.324
diff -c -p -d -r1.324 loop.c
*** loop.c	2001/02/25 00:08:01	1.324
--- loop.c	2001/03/16 11:48:01
*************** static int replace_label PARAMS ((rtx *,
*** 248,254 ****
  static rtx check_insn_for_givs PARAMS((struct loop *, rtx, int, int));
  static rtx check_insn_for_bivs PARAMS((struct loop *, rtx, int, int));
  static rtx gen_add_mult PARAMS ((rtx, rtx, rtx, rtx));
! static void loop_regs_update PARAMS ((const struct loop *, rtx));
  static int iv_add_mult_cost PARAMS ((rtx, rtx, rtx, rtx));

  static rtx loop_insn_emit_after PARAMS((const struct loop *, basic_block,
--- 248,254 ----
  static rtx check_insn_for_givs PARAMS((struct loop *, rtx, int, int));
  static rtx check_insn_for_bivs PARAMS((struct loop *, rtx, int, int));
  static rtx gen_add_mult PARAMS ((rtx, rtx, rtx, rtx));
! static void loop_regs_update PARAMS ((const struct loop *, rtx, rtx));
  static int iv_add_mult_cost PARAMS ((rtx, rtx, rtx, rtx));

  static rtx loop_insn_emit_after PARAMS((const struct loop *, basic_block,
*************** gen_add_mult (b, m, a, reg)
*** 6877,6885 ****
  /* Update registers created in insn sequence SEQ.  */

  static void
! loop_regs_update (loop, seq)
       const struct loop *loop ATTRIBUTE_UNUSED;
       rtx seq;
  {
    /* Update register info for alias analysis.  */

--- 6877,6886 ----
  /* Update registers created in insn sequence SEQ.  */

  static void
! loop_regs_update (loop, seq, insn)
       const struct loop *loop ATTRIBUTE_UNUSED;
       rtx seq;
+      rtx insn;
  {
    /* Update register info for alias analysis.  */

*************** loop_regs_update (loop, seq)
*** 6895,6901 ****
      }
    else
      {
!       rtx set = single_set (seq);
        if (set && GET_CODE (SET_DEST (set)) == REG)
  	record_base_value (REGNO (SET_DEST (set)), SET_SRC (set), 0);
      }
--- 6896,6902 ----
      }
    else
      {
!       rtx set = single_set (insn);
        if (set && GET_CODE (SET_DEST (set)) == REG)
  	record_base_value (REGNO (SET_DEST (set)), SET_SRC (set), 0);
      }
*************** loop_iv_add_mult_emit_before (loop, b, m
*** 6914,6920 ****
       basic_block before_bb;
       rtx before_insn;
  {
!   rtx seq;

    if (! before_insn)
      {
--- 6915,6921 ----
       basic_block before_bb;
       rtx before_insn;
  {
!   rtx seq, insn;

    if (! before_insn)
      {
*************** loop_iv_add_mult_emit_before (loop, b, m
*** 6930,6940 ****
    update_reg_last_use (b, before_insn);
    update_reg_last_use (m, before_insn);

!   loop_insn_emit_before (loop, before_bb, before_insn, seq);

    /* It is possible that the expansion created lots of new registers.
       Iterate over the sequence we just created and record them all.  */
!   loop_regs_update (loop, seq);
  }


--- 6931,6941 ----
    update_reg_last_use (b, before_insn);
    update_reg_last_use (m, before_insn);

!   insn = loop_insn_emit_before (loop, before_bb, before_insn, seq);

    /* It is possible that the expansion created lots of new registers.
       Iterate over the sequence we just created and record them all.  */
!   loop_regs_update (loop, seq, insn);
  }


*************** loop_iv_add_mult_sink (loop, b, m, a, re
*** 6948,6954 ****
       rtx a;          /* additive constant */
       rtx reg;        /* destination register */
  {
!   rtx seq;

    /* Use copy_rtx to prevent unexpected sharing of these rtx.  */
    seq = gen_add_mult (copy_rtx (b), m, copy_rtx (a), reg);
--- 6949,6955 ----
       rtx a;          /* additive constant */
       rtx reg;        /* destination register */
  {
!   rtx seq, insn;

    /* Use copy_rtx to prevent unexpected sharing of these rtx.  */
    seq = gen_add_mult (copy_rtx (b), m, copy_rtx (a), reg);
*************** loop_iv_add_mult_sink (loop, b, m, a, re
*** 6959,6969 ****
    update_reg_last_use (b, loop->sink);
    update_reg_last_use (m, loop->sink);

!   loop_insn_sink (loop, seq);

    /* It is possible that the expansion created lots of new registers.
       Iterate over the sequence we just created and record them all.  */
!   loop_regs_update (loop, seq);
  }


--- 6960,6970 ----
    update_reg_last_use (b, loop->sink);
    update_reg_last_use (m, loop->sink);

!   insn = loop_insn_sink (loop, seq);

    /* It is possible that the expansion created lots of new registers.
       Iterate over the sequence we just created and record them all.  */
!   loop_regs_update (loop, seq, insn);
  }


*************** loop_iv_add_mult_hoist (loop, b, m, a, r
*** 6977,6992 ****
       rtx a;          /* additive constant */
       rtx reg;        /* destination register */
  {
!   rtx seq;

    /* Use copy_rtx to prevent unexpected sharing of these rtx.  */
    seq = gen_add_mult (copy_rtx (b), m, copy_rtx (a), reg);

!   loop_insn_hoist (loop, seq);

    /* It is possible that the expansion created lots of new registers.
       Iterate over the sequence we just created and record them all.  */
!   loop_regs_update (loop, seq);
  }


--- 6978,6993 ----
       rtx a;          /* additive constant */
       rtx reg;        /* destination register */
  {
!   rtx seq, insn;

    /* Use copy_rtx to prevent unexpected sharing of these rtx.  */
    seq = gen_add_mult (copy_rtx (b), m, copy_rtx (a), reg);

!   insn = loop_insn_hoist (loop, seq);

    /* It is possible that the expansion created lots of new registers.
       Iterate over the sequence we just created and record them all.  */
!   loop_regs_update (loop, seq, insn);
  }




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