| This optimization has been around a long time. You are wrong about the timeline, it was added in 2012 well before the 4.8 branch point (it's closer to the 4.7 timeline). It was not added in a pre-release of gcc 4.8, and it was actually added to target some common cases. And in fact, it existed before then in other forms (I can point you at code back to 2004 doing the same thing). It has been on by default there for a long time. It happened to not miscompile SPEC before then by luck. ". After it turned out to miscompile SPEC, they disabled it for the case occuring there (it still seems to be on by default for other cases);" No, it was not. It is on by default for all cases, AFAICT.
Please point to the patch you think disabled it.
" it was disabled in released gcc-4.8 and all following gcc versions." Again, i don't see a patch that does this. If this has happened, i imagine it's not on purpose. Here's the current state of this optimization:
from https://gcc.gnu.org/svn/gcc/trunk/gcc/common.opt faggressive-loop-optimizations
Common Report Var(flag_aggressive_loop_optimizations) Optimization Init(1)
Aggressively optimize loops using language constraints. The Init(1) means it's on by default.
Note it is mentioned in the release notes for 4.8, for all versions:
https://gcc.gnu.org/gcc-4.8/changes.html Nowhere will you see something that says it is not the default, or will you see changes mentioning the default was changed. " When I asked a gcc maintainer about that, he wrote that it turned out that this "optimization" did not really provide a significant performance benefit; I asked how they evaluated that and he wrote that they used a set of relevant benchmarks." Which "gcc maintainer" did you ask?
I ask because i'm a listed maintainer for the SCEV related optimizations (see https://gcc.gnu.org/svn/gcc/trunk/MAINTAINERS) and you didn't ask me :) I asked Sebastian as well, and you didn't ask him. While compiler vendors do target SPEC, GCC generally does not, and in fact, has pretty much repeatedly refused optimizations that are only useful for SPEC. FYI: putting optimization in quotes repeatedly does not help your case. |
The gcc maintainer who justified that change to me is Andrew Haley. He may not be working on SCEV, whatever that is, but, unlike you, he admits to this change that has provably happened.