------- Comment #8 from uros at kss-loka dot si  2005-11-08 12:53 -------
> This patch fixes the failure for me, but...

... we actually gain nothing here.

>From .loop2_done, we have following sequence, where mem->reg load is pushed out
of the loop:

(insn 21 16 39 0 (set (reg:DF 64)
        (mem/u/c/i:DF (symbol_ref/u:SI ("*.LC0") [flags 0x2]) [0 S8 A64])) -1
(nil)
    (nil))
;; End of basic block 0, registers live:
 (nil)

(note 39 21 17 NOTE_INSN_LOOP_BEG)

;; Start of basic block 1, registers live: (nil)
(code_label 17 39 18 1 2 "" [1 uses])

(note 18 17 47 1 [bb 1] NOTE_INSN_BASIC_BLOCK)

(insn 47 18 22 1 (set (mem:DF (plus:SI (reg/f:SI 7 sp)
                (const_int 8 [0x8])) [0 S8 A32])
        (reg:DF 64)) -1 (nil)
    (nil))


However, in .postreload, the insn 21 (now insn 53) is moved back _into_ the
loop (why?):

(note 21 16 39 0 NOTE_INSN_DELETED)
;; End of basic block 0, registers live:
 6 [bp] 7 [sp] 16 [argp] 20 [frame] 60 64

(note 39 21 17 NOTE_INSN_LOOP_BEG)

;; Start of basic block 1, registers live: 6 [bp] 7 [sp] 59 60 64
(code_label 17 39 18 1 2 "" [1 uses])

(note 18 17 53 1 [bb 1] NOTE_INSN_BASIC_BLOCK)

(insn 53 18 47 1 (set (reg:DF 8 st)
        (mem/u/c/i:DF (symbol_ref/u:SI ("*.LC0") [flags 0x2]) [0 S8 A64])) 63
{*movdf_noin
teger} (nil)
    (nil))

(insn 47 53 54 1 (set (mem:DF (plus:SI (reg/f:SI 7 sp)
                (const_int 8 [0x8])) [0 S8 A32])
        (reg:DF 8 st)) 63 {*movdf_nointeger} (nil)
    (nil))


Proposed patch thus only fixes the damage. Otherwise, all this register
moving/copying doesn't gain anything, as reload fixes something on its own.

Also, REG_EQUAL notes are lost (before and after the patch). This results in
following asm:

        ...
        movl $-1717986918, 8(%esp)
        movl $1070176665, 12(%esp)
        fldl -16(%ebp)
        fstpl   (%esp)
        call dset
        movl $1, %ebx
.L2:
        fldl .LC0          <<< reload moves this insn back into the loop
        fstpl   8(%esp)
        fldl -16(%ebp)
        fstpl   (%esp)
        call dset
        incl %ebx
        cmpl $4, %ebx
        jne  .L2
        addl $36, %esp
        ...



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24265

Reply via email to