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



Steven Bosscher <steven at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

             Status|UNCONFIRMED                 |NEW

   Last reconfirmed|                            |2013-02-03

                 CC|steven at gcc dot gnu.org   |

     Ever Confirmed|0                           |1



--- Comment #3 from Steven Bosscher <steven at gcc dot gnu.org> 2013-02-03 
00:45:37 UTC ---

Confirmed.



My patch only avoids situations that ought not to happen in the first

place: self-referencing REG_EQUAL notes.  If this somehow prevents an

interesting code transformation I don't consider it my responsibility

to find out what that might be. Therefore I'm not taking this bug.



I did look at the difference in generated code. The regression is due

to the optabs.c change, reverting it results in the pre-r194054 code

again. The difference in code from the 'expand' pass is:



    86: NOTE_INSN_BASIC_BLOCK 13

    87: {r130:SI=r60:SI>>0x5;clobber flags:CC;}

    88: {r131:SI=r130:SI<<0x2;clobber flags:CC;}

    89: {r86:SI=r103:SI+r131:SI;clobber flags:CC;}

    90: {r132:SI=r60:SI&0x1f;clobber flags:CC;}

    91: r133:SI=`setmask'

-   92: r134:SI=[r132:SI*0x4+r133:SI]

-   93: {[r86:SI]=[r86:SI]|r134:SI;clobber flags:CC;}

+   94: r136:SI=[r132:SI*0x4+r133:SI]

+   95: r137:SI=[r86:SI]

+   96: {r135:SI=r137:SI|r136:SI;clobber flags:CC;}

+   97: [r86:SI]=r135:SI

       REG_EQUAL [r86:SI]|[r132:SI*0x4+r133:SI]

    // next basic block



The '+' code is the post-patch code, '-' is pre-patch (the continuous

numbering is due to the '-' code being rejected post-past, so those two

insn UIDs are lost).



Post-patch the extra moves of insns 95 and 97 are never cleaned up. The

extra move is introduced to make room for the REG_EQUAL note that is 

self-referencing in the pre-patch situation (SET of r86 with REG_EQUAL

note using r86). So the pre-patch RTL was indeed invalid.



Combine fails to restore the code to its pre-patch state because it

combines:



   94: r136:SI=[r132:SI*0x4+`setmask']

   95: r137:SI=[r86:SI]

   96: {r135:SI=r137:SI|r136:SI;clobber flags:CC;}



to:



   95: r137:SI=[r86:SI]

   96: {r135:SI=r137:SI|[r132:SI*0x4+`setmask'];clobber flags:CC;}



and the 'setmask' reference make merging the SET of r135 and the store

impossible:



Trying 96 -> 97:

Failed to match this instruction:

(parallel [

        (set (mem:SI (reg/f:SI 86 [ D.1803 ]) [2 *_41+0 S4 A32])

            (ior:SI (reg:SI 137 [ *_41 ])

                (mem:SI (plus:SI (mult:SI (reg:SI 132 [ D.1801 ])

                            (const_int 4 [0x4]))

                        (symbol_ref:SI ("setmask") <var_decl 0x7ffff63fb390

setmask>)) [2 setmaskD.1732 S4 A32])))

        (clobber (reg:CC 17 flags))

    ])

Failed to match this instruction:

(set (mem:SI (reg/f:SI 86 [ D.1803 ]) [2 *_41+0 S4 A32])

    (ior:SI (reg:SI 137 [ *_41 ])

        (mem:SI (plus:SI (mult:SI (reg:SI 132 [ D.1801 ])

                    (const_int 4 [0x4]))

                (symbol_ref:SI ("setmask") <var_decl 0x7ffff63fb390 setmask>))

[2 setmaskD.1732 S4 A32])))

Reply via email to