[Bug middle-end/58742] pointer arithmetic simplification

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jan 21 12:15:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58742

--- Comment #15 from Marc Glisse <glisse at gcc dot gnu.org> ---
Another example: http://stackoverflow.com/q/21253690/1918193

where we have (-DVERSION=2):
  _128 = img$_M_impl$_M_start_130 + 4000000;
  pretmp_146 = (long intD.12) _128;
  pretmp_145 = (long intD.12) img$_M_impl$_M_start_130;
  pretmp_76 = pretmp_146 - pretmp_145;
  pretmp_121 = pretmp_76 /[ex] 4;
  pretmp_120 = (size_typeD.24047) pretmp_121;

We miss that pretmp_120 is a constant, VRP thus fails to eliminate the range
checks, vectorization doesn't happen, and the code is more that 4 times slower
than it should be.

If the desired reassoc version is hard, a simple forwprop pattern matching
would already go a long way to alleviate this issue.



More information about the Gcc-bugs mailing list