Bug#187564: [Bug target/10692] [3.3/3.4/3.5 regression] [m68k] miscompilation of perl with -O2 -fPIC
------- Additional Comments From zippel at linux-m68k dot org 2004-06-06 17:21 -------
Here is a bit more info, this is the situation before reload:
(insn 365 364 366 18 bug-187564.i:90 (set (reg:SI 277)
(plus:SI (mult:SI (reg:SI 275)
(const_int 8 [0x8]))
(reg:SI 261))) 359 {*m68k.md:6544} (insn_list 363 (nil))
(expr_list:REG_DEAD (reg:SI 275)
(nil)))
(note 366 365 367 18 NOTE_INSN_DELETED)
(insn 367 366 368 18 bug-187564.i:90 (set (reg:SI 279)
(plus:SI (mult:SI (reg:SI 277)
(const_int 4 [0x4]))
(reg:SI 277))) 359 {*m68k.md:6544} (insn_list 365 (nil))
(expr_list:REG_DEAD (reg:SI 277)
(nil)))
Reload now decides to put (reg 277) and (reg 279) into %d1, which triggers the
reload as insn 367 needs it to be in an address register. This is the reload
information:
Reloads for insn # 365
Reload 0: reload_in (SI) = (reg:SI 0 %d0 [261])
reload_out (SI) = (reg:SI 1 %d1 [277])
ADDR_REGS, RELOAD_OTHER (opnum = 1)
reload_in_reg: (reg:SI 0 %d0 [261])
reload_out_reg: (reg:SI 1 %d1 [277])
reload_reg_rtx: (reg:SI 8 %a0)
Reload 1: ADDR_REGS, RELOAD_FOR_OUTPUT (opnum = 0)
reload_out_reg: (reg:SI 1 %d1 [277])
Reloads for insn # 367
Reload 0: reload_in (SI) = (reg:SI 1 %d1 [277])
reload_out (SI) = (reg:SI 1 %d1 [279])
ADDR_REGS, RELOAD_OTHER (opnum = 1)
reload_in_reg: (reg:SI 1 %d1 [277])
reload_out_reg: (reg:SI 1 %d1 [279])
reload_reg_rtx: (reg:SI 8 %a0)
Reload 1: ADDR_REGS, RELOAD_FOR_OUTPUT (opnum = 0)
reload_out_reg: (reg:SI 1 %d1 [279])
Everything is fine until insn 365, for which an input and an output reload is
generated. The problem is now that do_input_reload() for insn 367/reload 0
deletes the previous output reload, although insn 367 still needs the value as
input.
As a workaround I changed the '#if 0' in do_input_reload() into '#if 1', what
prevents the deletion of the reload and generates the following correct code:
(insn 645 364 365 18 bug-187564.i:90 (set (reg:SI 8 %a0)
(reg:SI 0 %d0 [261])) 25 {*m68k.md:749} (nil)
(nil))
(insn 365 645 646 18 bug-187564.i:90 (set (reg:SI 8 %a0)
(plus:SI (mult:SI (reg:SI 1 %d1 [275])
(const_int 8 [0x8]))
(reg:SI 8 %a0))) 359 {*m68k.md:6544} (insn_list 363 (nil))
(nil))
(insn 646 365 366 18 bug-187564.i:90 (set (reg:SI 1 %d1 [277])
(reg:SI 8 %a0)) 25 {*m68k.md:749} (nil)
(nil))
(note 366 646 367 18 NOTE_INSN_DELETED)
(insn 367 366 647 18 bug-187564.i:90 (set (reg:SI 8 %a0)
(plus:SI (mult:SI (reg:SI 1 %d1 [277])
(const_int 4 [0x4]))
(reg:SI 8 %a0))) 359 {*m68k.md:6544} (insn_list 365 (nil))
(nil))
(insn 647 367 368 18 bug-187564.i:90 (set (reg:SI 1 %d1 [279])
(reg:SI 8 %a0)) 25 {*m68k.md:749} (nil)
(nil))
The register renaming pass later on eliminates the reload 646 correctly.
At this point now I have to pass as to what the correct solution is...
How can we tell do_input_reload() correctly that the reload is still needed?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10692
------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.
Reply to: