Implement constant folding in the IR backend for JVM

The newly added pass folds the set of constant functions of the
current backend, plus IrBuiltIns.
This commit is contained in:
Ting-Yuan Huang
2019-02-07 16:12:28 -08:00
committed by max-kammerer
parent 7e4d33be24
commit 79fcaae991
28 changed files with 576 additions and 7 deletions
@@ -4379,11 +4379,26 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/constants"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("comparisonFalse.kt")
public void testComparisonFalse() throws Exception {
runTest("compiler/testData/codegen/box/constants/comparisonFalse.kt");
}
@TestMetadata("comparisonTrue.kt")
public void testComparisonTrue() throws Exception {
runTest("compiler/testData/codegen/box/constants/comparisonTrue.kt");
}
@TestMetadata("constantsInWhen.kt")
public void testConstantsInWhen() throws Exception {
runTest("compiler/testData/codegen/box/constants/constantsInWhen.kt");
}
@TestMetadata("divisionByZero.kt")
public void testDivisionByZero() throws Exception {
runTest("compiler/testData/codegen/box/constants/divisionByZero.kt");
}
@TestMetadata("float.kt")
public void testFloat() throws Exception {
runTest("compiler/testData/codegen/box/constants/float.kt");
@@ -17176,6 +17191,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/primitiveTypes/kt2269.kt");
}
@TestMetadata("kt2269NotOptimizable.kt")
public void testKt2269NotOptimizable() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/kt2269NotOptimizable.kt");
}
@TestMetadata("kt2275.kt")
public void testKt2275() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/kt2275.kt");