/// CHECK-START: int Main.testTrueBranch(int, int) dead_code_elimination$after_inlining (after) /// CHECK-NOT: If /// CHECK-NOT: Sub /// CHECK-NOT: Phi
publicstaticint testTrueBranch(int x, int y) { int z; if ($inline$constantTrue()) {
z = x + y;
} else {
z = x - y; // Prevent HSelect simplification by having a branch with multiple instructions.
System.nanoTime();
} return z;
}
/// CHECK-START: int Main.testFalseBranch(int, int) dead_code_elimination$after_inlining (after) /// CHECK-NOT: If /// CHECK-NOT: Add /// CHECK-NOT: Phi
publicstaticint testFalseBranch(int x, int y) { int z; if ($inline$constantFalse()) {
z = x + y;
} else {
z = x - y; // Prevent HSelect simplification by having a branch with multiple instructions.
System.nanoTime();
} return z;
}
/// CHECK-START: int Main.testRemoveLoop(int) dead_code_elimination$after_inlining (before) /// CHECK: Mul
/// CHECK-START: int Main.testRemoveLoop(int) dead_code_elimination$after_inlining (after) /// CHECK-NOT: Mul
publicstaticint testRemoveLoop(int x) { if ($inline$constantFalse()) { for (int i = 0; i < x; ++i) {
x *= x;
}
} return x;
}
/// CHECK-START: int Main.testUpdateLoopInformation(int) dead_code_elimination$after_inlining (before) /// CHECK-DAG: If /// CHECK-DAG: If /// CHECK-DAG: Add
/// CHECK-START: int Main.testUpdateLoopInformation(int) dead_code_elimination$after_inlining (after) /// CHECK-NOT: If /// CHECK-NOT: Add
publicstaticint testUpdateLoopInformation(int x) { // Use of Or in the condition generates a dead loop where not all of its // blocks are removed. This forces DCE to update their loop information. while ($inline$constantFalse() || !$inline$constantTrue()) {
x++;
} return x;
}
publicstaticint testRemoveSuspendCheck(int x, int y) { // Inner loop will leave behind the header with its SuspendCheck. DCE must // remove it, otherwise the outer loop would end up with two. while (y > 0) { while ($inline$constantFalse() || !$inline$constantTrue()) {
x++;
}
y--;
} return x;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.