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

Drea Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |121364
             Status|UNCONFIRMED                 |NEW
           Severity|normal                      |enhancement
           Keywords|                            |missed-optimization
     Ever confirmed|0                           |1
          Component|libstdc++                   |tree-optimization
   Last reconfirmed|                            |2026-06-10

--- Comment #3 from Drea Pinski <pinskia at gcc dot gnu.org> ---
So at -O2 we could optimize this (I have not looked into libstdc++ sources).

We have
  # .MEM_20 = VDEF <.MEM_19>
  MEM[(struct array *)&__tmp + 8B] = {};
...

  # .MEM_78 = PHI <.MEM_86(6), .MEM_85(7), .MEM_87(8)>
  # .MEM_88 = VDEF <.MEM_78>
  MEM[(struct array *)__position_1] = MEM[(struct array &)&__tmp + 8];

But currently the optimization for zero prop stops at phi nodes.
So this is missed out.  I have some idea on how to fix this but currently not
working on it.


clang is able to handle this at -O1+.

Note with libc++, LLVM fails at all optimizations level.

So confirmed for the missing gimple level optimization.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121364
[Bug 121364] [meta-bug] copy prop for aggregates

Reply via email to