-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillacode-qualityenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing featureloopoptim
Description
| Bugzilla Link | 707 |
| Resolution | FIXED |
| Resolved on | Feb 22, 2010 12:45 |
| Version | 1.0 |
| OS | All |
Extended Description
Consider this simple case:
void test(int N, int* P) {
int i, j;
for (j = 0; j < N; ++j)
for (i = 0; i < N; ++i)
P[i+j] = 0;
}
The inner loop does a comparison of N against 0 to see if it should enter the inner loop. This test is
invariant in the outer loop (and even shared) so it is hoisted. Despite this, we still do the comparison
each time through the outer loop. If the comparison can't succeed, and if the outer loop does no other
work, we should do a trivial unswitch on that value.
This is particularly important if the outer loop has many more iterations than the inner loop, such as in
173.applu and other programs.
-Chris
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillacode-qualityenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing featureloopoptim