In the following testcase load-PRE is not able to hoist the load of *x out of the loop because of the empty loop.
int foo(int k, int *x) { int j=0; int res; do { for (int n=0;n<3;++n); res = *x; } while (++j<k); return res; } -- Summary: load-PRE confused by control flow Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org OtherBugsDependingO 22501 nThis: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27755