[Bug tree-optimization/78180] Poor optimization of std::array on gcc 4.8/5.4/6.2 as compared to simple raw array
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 3 02:03:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78180
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
By moving the array to be end of struct Rolling, GCC does the correct thing and
optimizing out the load of idx out of the loop.
That is:
template <class C> class Rolling {
uint32_t idx_;
const uint32_t size_;
C times_{};
----- CUT-----------
Basically:
MEM[(value_type &)&r][_54] = _2;
Is not treated as referencing the array field but rather referencing the whole
struct so SRA thinks it cannot do anything with it.
More information about the Gcc-bugs
mailing list