This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 11 Jul 2018 05:53:42 +0000
- Subject: [Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays
- Auto-submitted: auto-generated
- References: <bug-86471-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471
--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
There have been questions before about enabling (parts of) ldist at -O2.
(In reply to Matt Bentley from comment #3)
> I thought I should note that there is also a missing optimization
> opportunity in the code. Clang optimizes the code I've listed to remove the
> benchmark loops entirely since it detects that the arrays aren't actually
> being used for anything.
Indeed, I am surprised gcc didn't optimize out all those useless writes (ints
is local and doesn't escape). Seems worth investigating a bit.