In this example:
int g(void);
void f(int *p, int i)
{
p[i] = g();
p[i + 2] = g();
p[i + 10] = g();
p[i + 100] = g();
}
the common expression of (p + i * 4) isn't completely eliminated.
It works with the current stable Debian release (gcc (GCC) 4.1.2 20061115), but
anything later misses this opportunity.
--
Summary: missed optimization to eliminate duplicate expressions
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: zippel at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32553