This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] reorder_blocks: fix for gcc.dg/20000503-1.c
- To: gcc-patches at gcc dot gnu dot org
- Subject: [patch] reorder_blocks: fix for gcc.dg/20000503-1.c
- From: DJ Delorie <dj at redhat dot com>
- Date: Fri, 5 Jan 2001 16:12:16 -0500
Applied with Richard Henderson's permission.
2001-01-05 DJ Delorie <dj@redhat.com>
* function.c (reorder_blocks): Make sure the flags are all reset
before using them to mark blocks, else a second invocation will
corrupt the block chain.
(reorder_blocks_0): New, resets the flags.
Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.240
diff -p -3 -r1.240 function.c
*** function.c 2001/01/04 23:28:00 1.240
--- function.c 2001/01/05 21:01:01
*************** static void pad_below PARAMS ((struct a
*** 275,280 ****
--- 275,281 ----
static rtx round_trampoline_addr PARAMS ((rtx));
static rtx adjust_trampoline_addr PARAMS ((rtx));
static tree *identify_blocks_1 PARAMS ((rtx, tree *, tree *, tree *));
+ static void reorder_blocks_0 PARAMS ((rtx));
static void reorder_blocks_1 PARAMS ((rtx, tree, varray_type *));
static tree blocks_nreverse PARAMS ((tree));
static int all_blocks PARAMS ((tree, tree *));
*************** reorder_blocks ()
*** 5789,5794 ****
--- 5790,5796 ----
BLOCK_SUBBLOCKS (block) = NULL_TREE;
BLOCK_CHAIN (block) = NULL_TREE;
+ reorder_blocks_0 (get_insns ());
reorder_blocks_1 (get_insns (), block, &block_stack);
BLOCK_SUBBLOCKS (block) = blocks_nreverse (BLOCK_SUBBLOCKS (block));
*************** reorder_blocks ()
*** 5798,5803 ****
--- 5800,5834 ----
/* Helper function for reorder_blocks. Process the insn chain beginning
at INSNS. Recurse for CALL_PLACEHOLDER insns. */
+
+ static void
+ reorder_blocks_0 (insns)
+ rtx insns;
+ {
+ rtx insn;
+
+ for (insn = insns; insn; insn = NEXT_INSN (insn))
+ {
+ if (GET_CODE (insn) == NOTE)
+ {
+ if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG)
+ {
+ tree block = NOTE_BLOCK (insn);
+ TREE_ASM_WRITTEN (block) = 0;
+ }
+ }
+ else if (GET_CODE (insn) == CALL_INSN
+ && GET_CODE (PATTERN (insn)) == CALL_PLACEHOLDER)
+ {
+ rtx cp = PATTERN (insn);
+ reorder_blocks_0 (XEXP (cp, 0));
+ if (XEXP (cp, 1))
+ reorder_blocks_0 (XEXP (cp, 1));
+ if (XEXP (cp, 2))
+ reorder_blocks_0 (XEXP (cp, 2));
+ }
+ }
+ }
static void
reorder_blocks_1 (insns, current_block, p_block_stack)