This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: optimization/10185: [3.3/3.4 regression] Wrong code with 3-int-structs & optimization


http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10185

Aloha,
This bug has similar symptoms to PR opt/10087.  The gcse pass generates
the following code (notice insn 106 is redundant to insn 103):

(insn 22 88 103 3 0x4014b764 (parallel [
            (set (reg/s:SI 65)
                (plus:SI (reg:SI 79)
                    (const_int -1 [0xffffffff])))
            (clobber (reg:CC 17 flags))
        ]) 146 {*addsi_1} (nil)
    (nil))

(insn 103 22 23 3 (nil) (set (reg:SI 79)
        (reg/s:SI 65)) 38 {*movsi_1} (nil)
    (nil))

(insn 23 103 106 3 0x4014b764 (set (mem/f:SI (plus:SI (reg/f:SI 20 frame)
                (const_int -4 [0xfffffffc])) [5 S4 A32])
        (reg/s:SI 65)) 38 {*movsi_1} (nil)
    (expr_list:REG_EQUAL (plus:SI (reg:SI 67)
            (const_int -1 [0xffffffff]))
        (nil)))

(insn 106 23 25 3 (nil) (set (reg:SI 79)
        (reg/s:SI 65)) 38 {*movsi_1} (nil)
    (nil))

The loop pass then considers insn 103 and insn 106 as places where biv 79
is incremented.  This is incorrect since insn 106 sets reg 76 to the same
value as insn 103.  Now during strength reduction, the giv is incremented
after insn 103 and insn 106 resulting in a delta that is twice the correct
value.  This test case passes with the patch from:
http://gcc.gnu.org/ml/gcc-patches/2003-03/msg01932.html

- glen


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]