[Bug tree-optimization/78847] pointer arithmetic from c++ ranged-based for loop not optimized
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 19 12:58:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78847
Marc Glisse <glisse at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2016-12-19
Component|middle-end |tree-optimization
Ever confirmed|0 |1
Severity|normal |enhancement
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
Not sure what the best angle is here.
_18 = (unsigned long) &MEM[(void *)&foo + 9B];
_16 = _18 + 1;
looks like it would be better as:
_19 = (unsigned long) &foo;
_16 = _19 + 10;
(I guess we don't want to produce &MEM[(void *)&foo + 10B])
But that might not be true anymore if _18 had several uses.
Reassoc could also play a role, either to cancel the two +1, or to put the two
converted addresses together.
I guess extra match.pd patterns might be doable as well, but I am scared of the
number of variants that might appear.
More information about the Gcc-bugs
mailing list