[Bug rtl-optimization/69691] [6 Regression] wrong code at -O2 on x86_64-linux-gnu
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 5 14:31:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69691
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
CC| |vmakarov at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This looks like a LRA bug.
We have:
(insn 153 152 276 18 (parallel [
(set (reg/f:DI 183 [ ivtmp.58 ])
(plus:DI (reg/f:DI 20 frame)
(const_int -608 [0xfffffffffffffda0])))
(clobber (reg:CC 17 flags))
]) 219 {*adddi_1}
(expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_EQUIV (plus:DI (reg/f:DI 20 frame)
(const_int -608 [0xfffffffffffffda0]))
(nil))))
...
(insn 64 159 185 18 (set (reg:DI 182 [ ivtmp.58 ])
(reg/f:DI 183 [ ivtmp.58 ])) pr69691.c:94 85 {*movdi_internal}
(expr_list:REG_EQUAL (plus:DI (reg/f:DI 20 frame)
(const_int -608 [0xfffffffffffffda0]))
(nil)))
(insn 186 185 323 18 (set (reg:SI 247)
(plus:SI (plus:SI (subreg:SI (reg/f:DI 183 [ ivtmp.58 ]) 0)
(subreg:SI (reg:DI 202) 0))
(const_int 1 [0x1]))) 214 {*leasi}
(nil))
in *.ira, and LRA creates:
(note 153 152 349 18 NOTE_INSN_DELETED)
...
(insn 64 350 185 18 (set (reg:DI 3 bx [orig:182 ivtmp.58 ] [182])
(plus:DI (reg/f:DI 7 sp)
(const_int 32 [0x20]))) pr69691.c:94 215 {*leadi}
(expr_list:REG_EQUAL (plus:DI (reg/f:DI 20 frame)
(const_int -608 [0xfffffffffffffda0]))
(nil)))
(note 185 64 186 18 NOTE_INSN_DELETED)
(insn 186 185 351 18 (set (reg:SI 0 ax [247])
(plus:SI (plus:SI (reg:SI 7 sp)
(reg:SI 42 r13 [202]))
(const_int 65 [0x41]))) 214 {*leasi}
(nil))
out of this. Note, frame-608 is eliminated to sp+32 (looks correct), but in
insn 186 which is supposed to be (int)(frame-608) + (int)r13 + 1 the used
offset is 65, instead of 32+1, so it seems that the 32 from sp+32 got added
twice there during LRA. Vlad, can you please have a look?
That said, on the generated assembly, I find it weird that nothing post reload
CSEs simple stuff like:
leaq 32(%rsp), %rdi
leaq 32(%rsp), %r14
or
leaq 32(%rsp), %rax
movl %esi, %esi
leaq 336(%rsp), %r14
leaq 32(%rsp), %rbx
Wouldn't it be smaller and better to use movq %rdi, %r14 or movq %rax, %rbx?
Smaller for sure (movq is 2 bytes smaller than leaq with 1 byte immediate).
More information about the Gcc-bugs
mailing list