Open
Description
... as described by Andreas here. From what I've read, it's basically the same as what the dreaded PhiBElimination
did before, e.g. redirecting control flow when the result is known coming from some basic block.
Loop unrolling will probably also play nicely with CommonSubexpressionElimination
, in that it will do invariant code motion if unrolled at least once! After all, the loop is still dominated by the first unroll, which computes invariant code (#126), which will be identified and removed by CommonSubexpressionElimination
. E.g.:
int i = 0;
int j = System.in.read(); /* Something that isn't constant folded */
while (i < 10) {
int k = j + 5;
if (k < 10) {
i++;
}
}
/*
===
Unroll once
===
*/
int i = 0;
int j = System.in.read();
if (i < 10) {
int k = j + 5;
if (k < 10) {
i++;
}
while (i < 10) {
int k2 = j + 5;
if (k2 < 10) {
i++;
}
}
}
/*
===
CSE
===
*/
int i = 0;
int j = System.in.read();
if (i < 10) {
int k = j + 5;
if (k < 10) {
i++;
}
while (i < 10) {
if (k < 10) {
i++;
}
}
}
... Nice.
Metadata
Assignees
Labels
No labels