[Bug tree-optimization/57702] New: Reassoc missed optimizations
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jun 24 18:18:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57702
Bug ID: 57702
Summary: Reassoc missed optimizations
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
On:
int f1 (int x, int y) { x += y; return x + 3 * y; }
unsigned int f2 (unsigned int x, unsigned int y) { x += y; return x + 3 * y; }
int f3 (int x, int y) { x += 7 * y; return x + 12 * y; }
unsigned int f4 (unsigned int x, unsigned int y) { x += 7 * y; return x + 12 *
y; }
reassoc optimizes only the f4 function into x += 19 * y; at the tree level, and
at the RTL level combiner happens to optimize it except for f3, which has more
insns than f4. I don't see why not optimizing this even for signed types would
be problematic, as long as the multiplication is performed in the same signed
type and all terms have the same sign (with different sizes the optimization
could remove undefined overflow, but I don't see how it could introduce it).
When things are vectorized the RTL optimizations will hardly help though.
More information about the Gcc-bugs
mailing list