This was discussed with Dan Berlin. File this report as a place holder for the problem. In the following example, load of g1.a at return statement is fully redundant, but not removed.
int g2; struct A { int a; int b; }g1; int foo(int a, int b) { if (a > 0) { g1.a = a+ b; } else g1.a = b; g2 = a+b; return g1.a; } -- Summary: Missing PRE for globals Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: xinliangli at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35286