------- Additional Comments From rearnsha at gcc dot gnu dot org  2004-10-29 16:43 
-------
I think the key to what has failed here is that the reg-rename pass has missed
the equivalence between start->index and a member of the copied structure.

In pseudo code, the output from the previous pass has the following instructions

        r2 := [ip+8]/4
        cc := cmp r2, #0
ne(cc): r0, r1, r2 := [r0]/12
ne(cc): [ip]/12 := r0, r1, r2   // Note [ip+8]/4 set to new r2 ...
        cc := cmp r2, #1        // ...so no need to reload it here
gt(cc): r3 := #0
gt(cc): [ip+8]/4 := r3
        return

Note that r2 is updated by the first conditional instruction (a conditional ldm
on ARM).  The conditional move code on ARM uses hard registers, but CSE has
clearly noticed this equivalence at some point and merged the two uses to avoid
a redundant re-load of start->index.  Unfortunately, rename_registers has missed
this and split the two uses up again.  This creates a use of r2 when it isn't
correctly initialized.

        r1 := [ip+8]/4
        cc := cmp r1, #0
ne(cc): r0, r1, r2 := [r0]/12
ne(cc): [ip]/12 := r0, r1, r2
        cc := cmp r2, #1        // r2 incorrect if previous insn not exec
gt(cc): r3 := #0
gt(cc): [ip+8]/4 := r3
        return

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |rtl-optimization


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

Reply via email to