[Bug c++/116416] Missing optimization: compile time evaluation of prvalue
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Dec 11 16:21:26 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116416
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 59834
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59834&action=edit
gcc15-pr116416-opt.patch
I've tried to implement a simple optimization (on top of the PR118002 fix),
where we clear just a subobject that needs padding or other uninitialized bits
cleared rather than the whole object.
On the pr78687.C testcase, this results (in gimple dump) in:
- D.10177 = {};
+ D.10177._storage.D.9582.D.9163._tail.D.9221._tail.D.9280._head = {};
because as I wrote, the single byte option_2() is the only part of the object
that actually needs to have padding bits cleared, rather than the rather large
whole object.
Though, SRA still punts even on that.
More information about the Gcc-bugs
mailing list