Eliminate redundant CHECKCAST instructions

CHECKCAST is redundant if the corresponding static type exactly matches the target type.
CHECKCAST instructions to-be-reified should not be eliminated.

KT-14811 Unnecessary checkcast generated in parameterized functions
KT-14963 unnecessary checkcast java/lang/Object
This commit is contained in:
Dmitry Petrov
2017-02-15 11:36:49 +03:00
parent ec403bfdbc
commit a087ea559f
8 changed files with 91 additions and 5 deletions
@@ -713,6 +713,18 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/bytecodeText/checkcast"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("kt14811.kt")
public void testKt14811() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/checkcast/kt14811.kt");
doTest(fileName);
}
@TestMetadata("kt14963.kt")
public void testKt14963() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/checkcast/kt14963.kt");
doTest(fileName);
}
@TestMetadata("kt15411.kt")
public void testKt15411() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/checkcast/kt15411.kt");