https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121218

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|tree-optimization           |rtl-optimization
             Target|                            |x86_64-*-*
           Priority|P3                          |P2
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |rsandifo at gcc dot gnu.org

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
Besides REG note changes CSE2 (when disabling CSE1) only does two things:

-  189: [r117:DI]=r193:DI
+  189: [r117:DI]=r154:TI#0
...
-  195: [r120:DI]=r195:DI
+  195: [r120:DI]=r155:TI#0

But we have

  181: r193:DI=r154:TI#0
  182: r194:DI=r154:TI#8
      REG_DEAD r154:TI
  183: r195:DI=r155:TI#0
  184: r196:DI=r155:TI#8
      REG_DEAD r155:TI

and CSE fails to remove those REG_DEAD notes.

The x86 STV pass is exposing this issue, -mno-stv fixes it.  It's also
interesting CSE1 triggers the issue as well, but that runs before STV.

STV only does

-   68: [r99:DI+0x48]=0
+  205: r207:V1TI=const_vector
+   68: [r99:DI+0x48]=r207:V1TI
       REG_DEAD r99:DI

with or without CSE1, so possibly the const_vector trigges the error.

With CSE1 disabled and -mno-stv CSE2 still performs the bogus transform,
but it doesn't trigger a miscompile.

Jakub and Richard S. fixed the last CSE bugs, I hope they know their way
around cse.cc, esp. where it's supposed to remove REG_DEAD and why that
doesn't happen for SUBREG_REGs.  The issue is likely latent for a while.

Reply via email to