In the attached code, the if-conversion opportunity in PR37240 does not benefit a Pentium 4. However, there is another optimization possible on both systems, namely changing
while ((maxIdx += maxIdx) < last) { if (numbers[maxIdx] < numbers[maxIdx + 1]) maxIdx++; if (tmp >= numbers[maxIdx]) break; numbers[top] = numbers[maxIdx]; top = maxIdx; } to while ((maxIdx += maxIdx) < last) { int a = numbers[maxIdx], b = numbers[maxIdx + 1]; if (a < b) maxIdx++, a = b; if (tmp >= a) break; numbers[top] = a; top = maxIdx; } It seems to me that numbers[maxIdx] is partially redundant (it is available if maxIdx++ is not executed). If an additional load of numbers[maxIdx + 1] is inserted in the "then" branch, it can also be found to be fully redundant so that copy propagation generates the optimized code. This gives a ~3% performance increase on i686-pc-linux-gnu for this benchmark. -- Summary: missed load PRE-like opportunity Product: gcc Version: 4.3.2 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bonzini at gnu dot org GCC target triplet: i686-pc-linux-gnu BugsThisDependsOn: 37239 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37242