This is the mail archive of the gcc-bugs@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: Another bootstrap failure on vax: label referred to in addr_vec deleted when basic block is moved to the fallthru position after the addr_vec


> After adding this patch
> <http://gcc.gnu.org/ml/gcc-patches/2001-09/msg01155.html> to a build
> on vax-dec-ultrix4.3, the build goes somewhat further but again trips
> on an addr_diff_vec problem:
> 
> stage1/xgcc -Bstage1/ -B/usr/local/vax-dec-ultrix4.3/bin/ -c  -DIN_GCC    -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long  -DHAVE_CONFIG_H -DGENERATOR_FILE    -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/config -I../../gcc/../include ../../gcc/rtl.c -o rtl.o
> /usr/tmp//ccVcGZ6G.s: Assembler messages:
> /usr/tmp//ccVcGZ6G.s:2801: Error: subtraction of two symbols in different sections `L112' {unknown section} - `L124' {text section} at file address 7805
> /usr/tmp//ccVcGZ6G.s:2801: Error: subtraction of two symbols in different sections `L112' {unknown section} - `L124' {text section} at file address 7803
> ...
> 
> The label L112 is deleted in the bbro pass:
> 
> ;; Function rtx_equal_p
> 
> try_optimize_cfg iteration 1
> ...
> Forwarding edge 5->6 to 14 failed.
> ...
> Reordering block 14 after 6
> ...
> Basic block 14: first insn 138, last 566, loop_depth 0, count 0, freq 424.
> Predecessors:  6 [100.0%]  5 [16.7%] 
> Successors:  15 [68.5%]  (fallthru) 34 [31.5%] 
> Registers live at start: 0 [r0] 6 [r6] 7 [r7] 9 [r9] 10 [r10] 11 [r11] 12 [ap] 1
> 3 [fp] 14 [sp]
> Registers live at end: 6 [r6] 7 [r7] 8 [r8] 9 [r9] 10 [r10] 11 [r11] 12 [ap] 13 
> [fp] 14 [sp]
> ...
> Reordered sequence:
> ...
>  7 bb 6 freq 212
>  8 bb 14 freq 424
> ...
> try_optimize_cfg iteration 1
> 
> Forwarding edge 6->7 to 8 failed.
> Removing jump 136.
> Deleting fallthru block 7.
> Deleted label in block 7.
> 
> Jump 136 was to code_label 138 which in the previous pass was the first insn
> in bb 14.  The label deleted was label 138.  After bbro we have,
> 
> ;; Start of basic block 6, registers live: 0 [r0] 6 [r6] 7 [r7] 8 [r8] 9 [r9] 10 [r10] 11 [r11] 12 [ap] 13 [fp] 14 [sp]
> (note 504 712 64 [bb 6] NOTE_INSN_BASIC_BLOCK)
> 
> (note 64 504 133 ("../../gcc/rtl.c") 589)
> 
> (jump_insn 133 64 134 (set (pc)
>         (if_then_else (leu (minus:SI (reg/v:SI 0 r0 [26])
>                     (const_int 52 [0x34]))
>                 (const_int 13 [0xd]))
>             (plus:SI (sign_extend:SI (mem:HI (plus:SI (pc)
>                             (mult:SI (minus:SI (reg/v:SI 0 r0 [26])
>                                     (const_int 52 [0x34]))
>                                 (const_int 2 [0x2]))) 0))
>                 (label_ref:SI 134))
>             (pc))) 142 {casesi1} (nil)
>     (nil))
> ;; End of basic block 6, registers live:
>  0 [r0] 6 [r6] 7 [r7] 8 [r8] 9 [r9] 10 [r10] 11 [r11] 12 [ap] 13 [fp] 14 [sp]
> 
> ;; Insn is not within a basic block
> (code_label 134 133 135 124 "" "" [1 uses])
> 
> ;; Insn is not within a basic block
> (jump_insn 135 134 122 (addr_diff_vec:HI (label_ref:SI 134)
>         [ 
>             (label_ref:SI 739)
>             (label_ref:SI 739)
>             (label_ref:SI 138)
>             (label_ref:SI 138)
>             (label_ref:SI 138)
>             (label_ref:SI 138)
>             (label_ref:SI 67)
>             (label_ref:SI 739)
>             (label_ref:SI 138)
>             (label_ref:SI 138)
>             (label_ref:SI 138)
>             (label_ref:SI 138)
>             (label_ref:SI 105)
>             (label_ref:SI 105)
>         ] 
>         (const_int 0 [0x0])
>         (const_int 0 [0x0])) -1 (nil)
>     (nil))
> 
> (note 122 135 704 ("../../gcc/rtl.c") 609)
> 
> (note 704 122 339 ("../../gcc/rtl.c") 673)
> 
> (note 339 704 700 ("../../gcc/rtl.c") 643)
> 
> (note 700 339 129 ("../../gcc/rtl.c") 673)
> 
> (note 129 700 522 ("../../gcc/rtl.c") 612)
> 
> ;; Start of basic block 7, registers live: 0 [r0] 6 [r6] 7 [r7] 9 [r9] 10 [r10] 11 [r11] 12 [ap] 13 [fp] 14 [sp]
> (note 522 129 139 [bb 7] NOTE_INSN_BASIC_BLOCK)
> 
> (note 139 522 141 ("../../gcc/rtl.c") 618)
> 
> (note 141 139 142 NOTE_INSN_DELETED)
> 
> (note 142 141 143 NOTE_INSN_DELETED)
> 
> (insn 143 142 144 (set (reg:SI 0 r0 [52])
>         (ashift:SI (reg/v:SI 0 r0 [26])
>             (const_int 2 [0x2]))) 92 {ashlsi3} (nil)
>     (nil))
> 
> Clearly, the label shouldn't have been deleted because there were still
> references to it in the addr_diff_vec.
This is weird.
If there is jumptable juping to the label, there should be edge that prevents
label from being deleted.
Moment - is it the case where fallthru edge of jump table and one of
destinations gets identical?  In that case CFG code sees the edge as "FALLHTUR"
and don't consider need to keep the label.

The code checks for posibility of conditional jumps with equivalent destinations:

	  if (b->pred->pred_next == NULL
	      && (b->pred->flags & EDGE_FALLTHRU)
	      && !(b->pred->flags & EDGE_COMPLEX)
	      && GET_CODE (b->head) == CODE_LABEL
	      && (!(mode & CLEANUP_PRE_SIBCALL)
		  || !tail_recursion_label_p (b->head))
	      /* If previous block ends with condjump jumping to next BB,
	         we can't delete the label.  */
	      && (b->pred->src == ENTRY_BLOCK_PTR
		  || !reg_mentioned_p (b->head, b->pred->src->end)))
Here we need to add something like:
	      && (!tablejump_p (b->pred->src->end)
		  || !reg_mentioned_p (b->head, NEXT_INSN (JUMP_LABEL (b->pred->src->end))))

I will try to send full patch tomorrow, but today I must leave.

Honza


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