* Fix buglet in previous mechanical loop.c change
@ 2004-07-15 19:31 Jeffrey A Law
2004-07-15 19:35 ` Daniel Jacobowitz
0 siblings, 1 reply; 3+ messages in thread
From: Jeffrey A Law @ 2004-07-15 19:31 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1600 bytes --]
The recent change to use various predicates instead of explicitly
testing for suitable rtx codes had a minor flaw. Consider this
change fragment from loop.c:
***************
*** 5482,5495 ****
}
/* Look for givs which are memory addresses. */
! if (GET_CODE (p) == INSN)
find_mem_givs (loop, PATTERN (p), p, not_every_iteration,
maybe_multiple);
/* Update the status of whether giv can derive other givs. This can
change when we pass a label or an insn that updates a biv. */
! if (GET_CODE (p) == INSN || GET_CODE (p) == JUMP_INSN
! || GET_CODE (p) == CODE_LABEL)
update_giv_derive (loop, p);
return p;
}
--- 5479,5491 ----
}
/* Look for givs which are memory addresses. */
! if (NONJUMP_INSN_P (p))
find_mem_givs (loop, PATTERN (p), p, not_every_iteration,
maybe_multiple);
/* Update the status of whether giv can derive other givs. This can
change when we pass a label or an insn that updates a biv. */
! if (INSN_P (p))
update_giv_derive (loop, p);
return p;
}
In particular note that we no longer call update_giv_derive if P is a
CODE_LABEL.
This can cause the loop optimizer to incorrectly reduce a GIV when it's
BIV is conditionally incremented.
I've been unable to trip this with unmodified sources, but it caused a
bootstrap failure (hang building libgcc with the stage2 compiler) with
a hacked compiler I'm using to evaluate the jump threading code.
This patch restores the previous behavior.
Bootstrapped on i686-pc-linux-gnu.
[-- Attachment #2: ZZZ --]
[-- Type: text/x-patch, Size: 1402 bytes --]
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 2.4542
diff -c -p -r2.4542 ChangeLog
*** ChangeLog 15 Jul 2004 13:46:05 -0000 2.4542
--- ChangeLog 15 Jul 2004 14:52:46 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2004-07-15 Jeff Law <law@redhat.com>
+
+ * loop.c (check_insn_for_givs): Restore check for code labels that was
+ accidentally deleted by a recent checkin.
+
2004-07-15 Nathan Sidwell <nathan@codesourcery.com>
* vec.h (VEC_T_truncate): Allow truncation of an empty vector.
Index: loop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/loop.c,v
retrieving revision 1.503
diff -c -p -r1.503 loop.c
*** loop.c 9 Jul 2004 03:29:33 -0000 1.503
--- loop.c 15 Jul 2004 14:53:01 -0000
*************** check_insn_for_givs (struct loop *loop,
*** 5485,5491 ****
/* Update the status of whether giv can derive other givs. This can
change when we pass a label or an insn that updates a biv. */
! if (INSN_P (p))
update_giv_derive (loop, p);
return p;
}
--- 5485,5491 ----
/* Update the status of whether giv can derive other givs. This can
change when we pass a label or an insn that updates a biv. */
! if (INSN_P (p) || LABEL_P (p))
update_giv_derive (loop, p);
return p;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fix buglet in previous mechanical loop.c change
2004-07-15 19:31 Fix buglet in previous mechanical loop.c change Jeffrey A Law
@ 2004-07-15 19:35 ` Daniel Jacobowitz
2004-07-15 20:35 ` Jeffrey A Law
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2004-07-15 19:35 UTC (permalink / raw)
To: Jeffrey A Law; +Cc: gcc-patches
On Thu, Jul 15, 2004 at 08:55:01AM -0600, Jeffrey A Law wrote:
> The recent change to use various predicates instead of explicitly
> testing for suitable rtx codes had a minor flaw. Consider this
> change fragment from loop.c:
>
> ! if (GET_CODE (p) == INSN || GET_CODE (p) == JUMP_INSN
> ! || GET_CODE (p) == CODE_LABEL)
> ! if (INSN_P (p))
> In particular note that we no longer call update_giv_derive if P is a
> CODE_LABEL.
>
> This can cause the loop optimizer to incorrectly reduce a GIV when it's
> BIV is conditionally incremented.
And you changed this to:
> ! if (INSN_P (p) || LABEL_P (p))
This now accepts CALL_INSN, which it didn't used to. Was that a bug in
the old code?
--
Daniel Jacobowitz
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fix buglet in previous mechanical loop.c change
2004-07-15 19:35 ` Daniel Jacobowitz
@ 2004-07-15 20:35 ` Jeffrey A Law
0 siblings, 0 replies; 3+ messages in thread
From: Jeffrey A Law @ 2004-07-15 20:35 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gcc-patches
On Thu, 2004-07-15 at 09:11, Daniel Jacobowitz wrote:
> On Thu, Jul 15, 2004 at 08:55:01AM -0600, Jeffrey A Law wrote:
> > The recent change to use various predicates instead of explicitly
> > testing for suitable rtx codes had a minor flaw. Consider this
[ ... ]
>
> This now accepts CALL_INSN, which it didn't used to. Was that a bug in
> the old code?
Acceping a CALL_INSN is conservatively correct. It won't have any
effect on the behavior of update_giv_derive except that unnecessary
work may be done.
Jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-07-15 15:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-15 19:31 Fix buglet in previous mechanical loop.c change Jeffrey A Law
2004-07-15 19:35 ` Daniel Jacobowitz
2004-07-15 20:35 ` Jeffrey A Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).