better redundant compare elimination (original) (raw)
This is the mail archive of the gcc-patches@gcc.gnu.orgmailing 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] |
- To: egcs at cygnus dot com
- Subject: better redundant compare elimination
- From: John Carr
- Date: Thu, 03 Sep 1998 07:02:36 EDT
- cc: egcs-patches at cygnus dot com
This patch eliminates redundant compares when a label is only reached from a jump by setting CC status according to the instruction preceding the branch.
This has a very small effect on the code I tried it on. Is it worth installing?
Any other comments?
*** final.c 1998/08/26 08:11:20 1.55 --- final.c 1998/09/03 01:59:08 *************** final (first, file, optimize, prescan) *** 1970,1975 **** --- 1970,1990 ---- if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > max_line) max_line = NOTE_LINE_NUMBER (insn); }
#ifdef HAVE_cc0
/* If CC tracking across branches is enabled, record the insn which
jumps to each branch only reached from one place. */
if (flag_expensive_optimizations)
for (insn = first; insn; insn = NEXT_INSN (insn))
{
rtx lab;
if (GET_CODE (insn) == JUMP_INSN
&& (lab = JUMP_LABEL (insn))
&& LABEL_NUSES (lab) == 1)
{
LABEL_REFS (lab) = insn;
}
}
#endif
line_note_exists = (char *) oballoc (max_line + 1); bzero (line_note_exists, max_line + 1);
*************** final_scan_insn (insn, file, optimize, p *** 2283,2289 **** --- 2298,2327 ---- ASM_OUTPUT_ALIGN (file, align); #endif }
- #ifdef HAVE_cc0 CC_STATUS_INIT;
/* If this label is reached from only one place, set the condition
codes from the instruction just before the branch. */
if (flag_expensive_optimizations && LABEL_NUSES (insn) == 1)
{
rtx jump = LABEL_REFS (insn);
rtx barrier = prev_nonnote_insn (insn);
rtx prev;
/* If the LABEL_REFS field of this label has been set to point
at a branch, the predecessor of the branch is a regular
insn, and that branch is the only way to reach this label,
set the condition codes based on the branch and its
predecessor. */
if (barrier && GET_CODE (barrier) == BARRIER
&& jump && GET_CODE (jump) == JUMP_INSN
&& (prev = prev_nonnote_insn (jump))
&& GET_CODE (prev) == INSN)
{
NOTICE_UPDATE_CC (PATTERN (prev), prev);
NOTICE_UPDATE_CC (PATTERN (jump), jump);
}
}
- #endif if (prescan > 0) break; new_block = 1;
- Follow-Ups:
- Re: better redundant compare elimination
* From: Jeffrey A Law
- Re: better redundant compare elimination
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |