[Bug target/59609] [4.9 Regression] LRA generates bad code for libgcc function udivmoddi4 on thumb1 target
terry.guo at arm dot com
gcc-bugzilla@gcc.gnu.org
Fri Dec 27 05:58:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59609
--- Comment #1 from Terry Guo <terry.guo at arm dot com> ---
Here are some investigations. In the dump of IRA pass, we have jump insn like:
(jump_insn 31 24 172 5 (parallel [
(set (pc)
(if_then_else (lt (plus:SI (reg/v:SI 119 [ i ])
(const_int -32 [0xffffffffffffffe0]))
(const_int 0 [0]))
(label_ref 35)
(pc)))
(set (reg:SI 181)
(plus:SI (reg/v:SI 119 [ i ])
(const_int -32 [0xffffffffffffffe0])))
(clobber (scratch:SI))
]) myudi.c:13 225 {*addsi3_cbranch}
(int_list:REG_BR_PROB 2100 (nil))
-> 35)
Next in the dump of reload pass, it is turned into:
(jump_insn 31 254 255 5 (parallel [
(set (pc)
(if_then_else (lt (plus:SI (reg:SI 3 r3 [181])
(const_int -32 [0xffffffffffffffe0]))
(const_int 0 [0]))
(label_ref 35)
(pc)))
(set (reg:SI 3 r3 [181])
(plus:SI (reg:SI 3 r3 [181])
(const_int -32 [0xffffffffffffffe0])))
(clobber (scratch:SI))
]) myudi.c:13 225 {*addsi3_cbranch}
(int_list:REG_BR_PROB 2100 (nil))
-> 35)
(insn 255 31 172 5 (set (reg:SI 12 ip [181])
(reg:SI 3 r3 [181])) myudi.c:13 197 {*thumb1_movsi_insn}
(nil))
The subsequent passes will change the position of insn 255 and cause ip
uninitialized when do jump.
When disable LRA, in reload pass the jump_insn 31 will be turned into something
like:
(jump_insn 31 255 172 5 (parallel [
(set (pc)
(if_then_else (lt (plus:SI (reg:SI 0 r0)
(const_int -32 [0xffffffffffffffe0]))
(const_int 0 [0]))
(label_ref 35)
(pc)))
(set (reg:SI 12 ip [181])
(plus:SI (reg:SI 0 r0)
(const_int -32 [0xffffffffffffffe0])))
(clobber (reg:SI 0 r0))
]) myudi.c:13 225 {*addsi3_cbranch}
(int_list:REG_BR_PROB 2100 (nil))
-> 35)
This is good and will produce correct code.
More information about the Gcc-bugs
mailing list