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.