------- Comment #1 from kazu at gcc dot gnu dot org 2006-05-11 18:44 -------
Just for a reference, here is execute/20030128-1.c.
unsigned char x = 50;
volatile short y = -5;
int main ()
{
x /= y;
if (x != (unsigned char) -10)
abort ();
exit (0);
}
Now, with -O1, the load of y completely disappears.
Here is the dump of 20030128-1.c.160r.shorten up to a call to
a division subroutine.
(insn/f 55 8 56 (parallel [
(set (mem/c:BLK (pre_dec:BLK (reg/f:SI 13 sp)) [0 A8])
(unspec:BLK [
(reg:SI 4 r4)
] 2))
(use (reg:SI 14 lr))
]) 302 {*push_multi} (nil)
(expr_list:REG_DEAD (reg:SI 14 lr)
(expr_list:REG_DEAD (reg:SI 4 r4)
(expr_list:REG_FRAME_RELATED_EXPR (sequence [
(set/f (reg/f:SI 13 sp)
(plus:SI (reg/f:SI 13 sp)
(const_int -8 [0xfffffffffffffff8])))
(set/f (mem/c:SI (reg/f:SI 13 sp) [0 S4 A32])
(reg:SI 4 r4))
(set/f (mem/c:SI (plus:SI (reg/f:SI 13 sp)
(const_int 4 [0x4])) [0 S4 A32])
(reg:SI 14 lr))
])
(nil)))))
(note 56 55 10 NOTE_INSN_PROLOGUE_END)
(note 10 56 11 NOTE_INSN_DELETED)
(note 11 10 13 NOTE_INSN_DELETED)
(note 13 11 14 NOTE_INSN_DELETED)
(note 14 13 15 NOTE_INSN_DELETED)
(insn 15 14 16 (set (reg/f:SI 4 r4 [108])
(mem:SI (label_ref 59) [0 S4 A32])) 145 {*arm_movsi_insn} (nil)
(expr_list:REG_EQUIV (symbol_ref:SI ("x") [flags 0x2] <var_decl 0xf7f71d80
x>)
(nil)))
(note 16 15 17 NOTE_INSN_DELETED)
(note 17 16 18 NOTE_INSN_DELETED)
(note 18 17 19 NOTE_INSN_DELETED)
(insn 19 18 20 (set (reg:SI 0 r0 [ x ])
(zero_extend:SI (mem/c/i:QI (reg/f:SI 4 r4 [108]) [0 x+0 S1 A8]))) 128
{*arm_zero_extendqis\i2} (insn_list:REG_DEP_TRUE 15 (nil))
(nil))
(insn 20 19 21 (set (reg:SI 1 r1)
(const_int 0 [0x0])) 145 {*arm_movsi_insn} (nil)
(nil))
(call_insn/u 21 20 23 (parallel [
(set (reg:SI 0 r0)
(call (mem:SI (symbol_ref:SI ("__aeabi_idiv") [flags 0x41]) [0
S4 A32])
(const_int 0 [0x0])))
(use (const_int 0 [0x0]))
(clobber (reg:SI 14 lr))
]) 230 {*call_value_symbol} (insn_list:REG_DEP_TRUE 19
(insn_list:REG_DEP_TRUE 20 (nil)))
(expr_list:REG_DEAD (reg:SI 1 r1)
(expr_list:REG_UNUSED (reg:SI 14 lr)
(expr_list:REG_EH_REGION (const_int -1 [0xffffffffffffffff])
(nil))))
(expr_list:REG_DEP_TRUE (use (reg:SI 1 r1))
(expr_list:REG_DEP_TRUE (use (reg:SI 0 r0 [ x ]))
(nil))))
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27538