This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/5844: Bad code generated for -O2 -mcpu=i586
- From: "H . J . Lu" <hjl at lucon dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 5 Mar 2002 18:26:42 -0800
- Subject: Re: optimization/5844: Bad code generated for -O2 -mcpu=i586
The bug is in copyprop_hardreg_forward. It turns
(insn 83 35 84 (set (reg:SI 0 eax)
(mem/s:SI (plus:SI (reg/v/f:SI 2 ecx [58])
(const_int 4 [0x4])) [4 <variable>.uncaughtExceptions+0 S4 A32])) -1 (nil)
(nil))
(insn 84 83 85 (parallel[
(set (reg:SI 0 eax)
(plus:SI (reg:SI 0 eax)
(const_int 1 [0x1])))
(clobber (reg:CC 17 flags))
] ) -1 (nil)
(expr_list:REG_UNUSED (reg:CC 17 flags)
(nil)))
(insn 85 84 40 (set (mem/s:SI (plus:SI (reg/v/f:SI 2 ecx [58])
(const_int 4 [0x4])) [4 <variable>.uncaughtExceptions+0 S4
A32])
(reg:SI 0 eax)) -1 (nil)
(expr_list:REG_DEAD (reg:SI 0 eax)
(nil)))
into
(insn 83 35 84 (set (reg:SI 0 eax)
(mem/s:SI (plus:SI (reg:SI 0 eax [58])
(const_int 4 [0x4])) [4 <variable>.uncaughtExceptions+0 S4
A32])
) 45 {*movsi_1} (nil)
(nil))
(insn 84 83 85 (parallel[
(set (reg:SI 0 eax)
(plus:SI (reg:SI 0 eax)
(const_int 1 [0x1])))
(clobber (reg:CC 17 flags))
] ) 207 {*addsi_1} (nil)
(expr_list:REG_UNUSED (reg:CC 17 flags)
(nil)))
(insn 85 84 40 (set (mem/s:SI (plus:SI (reg:SI 0 eax [58])
(const_int 4 [0x4])) [4 <variable>.uncaughtExceptions+0 S4
A32])
(reg:SI 0 eax)) 45 {*movsi_1} (nil)
(expr_list:REG_DEAD (reg:SI 0 eax [58])
(nil)))
When it sees
(insn 83 35 84 (set (reg:SI 0 eax)
(mem/s:SI (plus:SI (reg/v/f:SI 2 ecx [58])
(const_int 4 [0x4])) [4 <variable>.uncaughtExceptions+0 S4 A32])) -1 (nil)
(nil))
It believes it can replace ecx with eax since it uses the value data
from its predecessor where eax == ecx. Shouldn't it update the value
data before passing it to copyprop_hardreg_forward_1?
H.J.