public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* libcall problem during new unroller merge
@ 2003-02-06 13:59 Zdenek Dvorak
  2003-02-06 14:43 ` Jan Hubicka
  0 siblings, 1 reply; 7+ messages in thread
From: Zdenek Dvorak @ 2003-02-06 13:59 UTC (permalink / raw)
  To: gcc; +Cc: jh, rth

Hello,

during merging new loop unroller, I have encountered the following
problem (masked on rtlopt branch by other pass):

Consider loop in that strcmp is called; it is translated into rtl as

(insn 542 541 543 (nil) (set (reg:SI 236)
        (mem/s/u:SI (plus:SI (reg:SI 235)
                (reg:SI 231)) [9 <variable>.name+0 S4 A32])) -1 (nil)
    (nil))

(insn 543 542 544 (nil) (set (mem/f:SI (plus:SI (reg/f:SI 56 virtual-outgoing-args)
                (const_int 4 [0x4])) [0 S4 A32])
        (reg:SI 236)) -1 (nil)
    (insn_list:REG_LIBCALL 547 (nil)))

(insn 544 543 545 (nil) (set (reg:SI 237)
        (mem/f:SI (symbol_ref:SI ("ix86_cpu_string")) [9 ix86_cpu_string+0 S4 A32])) -1 (nil)
    (nil))

(insn 545 544 546 (nil) (set (mem/f:SI (reg/f:SI 56 virtual-outgoing-args) [0 S4 A32])
        (reg:SI 237)) -1 (nil)
    (nil))

(call_insn/u 546 545 547 (nil) (set (reg:SI 0 eax)
        (call (mem:QI (symbol_ref:SI ("strcmp")) [0 S1 A8])
            (const_int 8 [0x8]))) -1 (nil)
    (expr_list:REG_EH_REGION (const_int -1 [0xffffffff])
        (nil))
    (expr_list (use (mem:BLK (scratch) [0 A8]))
        (nil)))

(insn 547 546 548 (nil) (set (reg:SI 238)
        (reg:SI 0 eax)) -1 (nil)
    (insn_list:REG_RETVAL 543 (expr_list:REG_EQUAL (expr_list (use (mem:BLK (scratch) [0 A8]))
                (expr_list (symbol_ref:SI ("strcmp"))
                    (expr_list (mem/f:SI (symbol_ref:SI ("ix86_cpu_string")) [9 ix86_cpu_string+0 S4 A32])
                        (expr_list (mem/s/u:SI (plus:SI (reg:SI 235)
                                    (reg:SI 231)) [9 <variable>.name+0 S4 A32])
                            (nil)))))
            (nil))))

now first cse pass transforms insn 542 into

(insn 542 541 543 71 0x402e1108 (set (reg:SI 236 [ <variable>.name ])
        (mem/s/u:SI (plus:SI (reg:SI 235)
                (symbol_ref:SI ("processor_alias_table.2"))) [9 <variable>.name+0 S4 A32])) 38 {*movsi_1} (nil)
    (nil))

Reference in REG_EQUAL is not updated; set of reg. 231 disappears.

Similarily, reg. 235 disappears in global copy propagation (in
jump bypassing pass), being replaced by other register; again,
reference in REG_EQUAL is not updated.

REG_RETVAL note now refers only to non-existent registers, and unroller
creates 4 consecutive clones of this block.

Finally, second cse pass uses these notes to replace 3 of copies of insn
547 by

(insn 1870 1869 1871 150 0x4016bfa4 (set (reg:SI 238)
        (reg:SI 238)) 38 {*movsi_1} (nil)
    (expr_list:REG_EQUAL (expr_list (use (mem:BLK (scratch) [0 A8]))
            (expr_list (symbol_ref:SI ("strcmp"))
                (expr_list (mem/f:SI (symbol_ref:SI ("ix86_cpu_string")) [9 ix86_cpu_string+0 S4 A32])
                    (expr_list (mem/s/u:SI (plus:SI (reg:SI 235)
                                (reg/f:SI 231)) [9 <variable>.name+0 S4 A32])
                        (nil)))))
        (insn_list:REG_RETVAL 1866 (nil))))

causing misscompilation. In my opinion, the fact that REG_RETVAL note
refers to completely bogus expression is wrong; but I am not sure where
is the right place to fix it.

Zdenek

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-02-09  6:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-06 13:59 libcall problem during new unroller merge Zdenek Dvorak
2003-02-06 14:43 ` Jan Hubicka
2003-02-06 14:57   ` Jan Hubicka
2003-02-07 15:06   ` Zdenek Dvorak
2003-02-07 15:40     ` Jan Hubicka
2003-02-07 21:14       ` Zdenek Dvorak
2003-02-09  6:19       ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).