Loop.c bug

Richard Earnshaw rearnsha@arm.com
Fri Dec 17 07:37:00 GMT 1999


I think this was probably a latent bug that was exposed by Jan's recent 
gcse patch.  It causes a ICE on the ARM compiler during stage2 of a 
bootstrap.

What we had was the following

(insn (set (reg 150) (symbol_ref ("max_gcse_regno")))

...

(note loop top)

...

(insn (set (reg 151) (mem:SI (reg 150)))
  (expr_list:REG_EQUAL (mem:si (symbol_ref ("max_gcse_regno"))))
...

(note loop end)

The problem is that when insert_loop_mem runs it builds a list of all mems 
in the insns of a loop, including those inside the reg notes.  load_mems 
then iterates over this list and tries to hoist the references out of the 
loop.  It does two things wrong:

 1) It hoisted a reg_equal note without hoisting the body of the insn.
 2) It created an invalid mem in the rtl since it turned the note into a 
real move insn.

I believe both of these faults are a side effect of trying to put mem's 
from inside notes into the list of hoistable loads.  I think this is wrong 
and we should ignore these.

Fri Dec 17 10:34:16 1999  Richard Earnshaw <rearnsha@arm.com>

	* loop.c (insert_loop_mem): Don't record MEMs from inside 
	EXPR_LISTs.



More information about the Gcc-patches mailing list