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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-10-16
                 CC|richard.guenther at gmail dot com  |rguenth at gcc dot 
gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
If I configured correctly the only change (early) SRA does is

 unsigned int fn1K (unsigned int x)
 {
+  <unnamed-unsigned:6> y$k;
...
@@ -57,13 +53,14 @@

   <bb 2> :
   y = sK;
-  _1 = y.k;
+  y$k_13 = sK.k;
+  _1 = y$k_13;
   _2 = (unsigned char) _1;
   _3 = (unsigned char) x_9(D);
   _4 = _2 + _3;
   _5 = (<unnamed-unsigned:6>) _4;
-  y.k = _5;
-  _6 = y.k;
+  y$k_14 = _5;
+  _6 = y$k_14;
   _11 = (unsigned int) _6;
   y ={v} {CLOBBER(eol)};
   return _11;

and later DSE eliminates 'y' completely.  Note I can't see any big assembly
difference -O2 vs -O2 -fno-tree-sra so I wonder if I really reproduced the
significantly worse code generation issue.  In fact generated code looks
better, the stack slot is elided:

> diff -u t.s.good t.s.bad 
--- t.s.good    2023-10-16 10:18:27.457651977 +0200
+++ t.s.bad     2023-10-16 10:07:49.997656268 +0200
@@ -19,13 +19,11 @@
        .export fn1K
        .type   fn1K, @function
 fn1K:
-       subi    sp,8
        lrw     r7, sK
        ld.b    r7,(r7)
        addu    r2,r7
        movi    r7,63
        and     r2,r7
-       addi    sp,8
        jmp     r15
        .size   fn1K, .-fn1K
        .align  1

Reply via email to