```
public static int condgt(int a, int b) {
if (b > 0) {
if (b > -10) { // redundant test
return 0xdd;
}else {
return 0xff; // dead code
}
}else {
return 0xee;
}
}
```
For the test case above, "b > -10" could be removed safely as it's always true.
So far c2 did related work for BoolTest::eq but remains some other cases like ne, le, ge, lt, gt.
public static int condgt(int a, int b) {
if (b > 0) {
if (b > -10) { // redundant test
return 0xdd;
}else {
return 0xff; // dead code
}
}else {
return 0xee;
}
}
```
For the test case above, "b > -10" could be removed safely as it's always true.
So far c2 did related work for BoolTest::eq but remains some other cases like ne, le, ge, lt, gt.
- relates to
-
JDK-8263252 Improve fold_compares c2 optimizations
-
- Open
-
-
JDK-8275202 C2: optimize out more redundant conditions
-
- Open
-