------- Comment #7 from carrot at google dot com  2009-07-15 08:07 -------
(In reply to comment #6)
> Carrot, can you please try this test case with my patch
> "crossjump_abstract.diff" from Bug 20070 applied?
> 

I tried your patch. It did remove the redundant memory load. Following is the
output

        push    {lr}
        ldr     r3, [r1]
.L6:
        str     r3, [r0]
        mov     r2, r3          // M
        cmp     r3, #0
        bne     .L5
        b       .L3
.L4:
        ldr     r3, [r3, #8]
        b       .L6
.L5:
        ldr     r1, [r3, #4]
        cmp     r1, #0
        beq     .L4
.L3:
        str     r2, [r0, #12]
        @ sp needed for prologue
        pop     {pc}

In pass ifcvt it noticed the difference of two stores is the different pseudo
register number and there is no conflict between the two pseudo registers, so
it rename one of them to the same as another and do basic block cross jump on
them earlier. Then pass iterate.c.161r.cse2 detected the redundant load and
remove it.

But it introduced another redundant move instruction marked as M. At the place
r2 is used, r3 still contain the same result as r2, so we can also use r3
there. I think this is another problem.


-- 


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

Reply via email to