This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
doloop patch
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 30 Nov 2005 11:17:24 +0000
- Subject: doloop patch
I've installed this obvious fix in the doloop optimizer. I'm adding loop
instruction support to ms1, and discovered this bug.
Due to the way compares work on ms1, do_compare_rtx_and_jump has enough smarts
to figure out the jump is not merely unlikely, it is never taken. Thus it
doesn't emit it :) I don't know if this problem affects other doloop ports.
Is there a desire to see this on the 4.1 branch?
built & tested on ms1-elf.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2005-11-30 Nathan Sidwell <nathan@codesourcery.com>
* loop-doloop.c (add_test): Only add jump notes if we did emit a
jump.
Index: loop-doloop.c
===================================================================
--- loop-doloop.c (revision 107604)
+++ loop-doloop.c (working copy)
@@ -244,14 +244,18 @@ add_test (rtx cond, basic_block bb, basi
do_compare_rtx_and_jump (op0, op1, code, 0, mode, NULL_RTX, NULL_RTX, label);
jump = get_last_insn ();
- JUMP_LABEL (jump) = label;
+ /* It is possible for the jump to be optimized out. */
+ if (JUMP_P (jump))
+ {
+ JUMP_LABEL (jump) = label;
- /* The jump is supposed to handle an unlikely special case. */
- REG_NOTES (jump)
- = gen_rtx_EXPR_LIST (REG_BR_PROB,
- const0_rtx, REG_NOTES (jump));
+ /* The jump is supposed to handle an unlikely special case. */
+ REG_NOTES (jump)
+ = gen_rtx_EXPR_LIST (REG_BR_PROB,
+ const0_rtx, REG_NOTES (jump));
- LABEL_NUSES (label)++;
+ LABEL_NUSES (label)++;
+ }
seq = get_insns ();
end_sequence ();