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
@@ -1118,6 +1118,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/constants/byte.kt");
}
@TestMetadata("floatingPoints.kt")
public void testFloatingPoints() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/constants/floatingPoints.kt");
}
@TestMetadata("inlineUnsignedIntConstant.kt")
public void testInlineUnsignedIntConstant() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/constants/inlineUnsignedIntConstant.kt");
@@ -1472,6 +1477,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/boxing.kt");
}
@TestMetadata("boxingNotOptimizable.kt")
public void testBoxingNotOptimizable() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/boxingNotOptimizable.kt");
}
@TestMetadata("emptyVariableRange.kt")
public void testEmptyVariableRange() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/emptyVariableRange.kt");
@@ -1501,6 +1511,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
public void testSimpleConstructorNotRedundant() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/simpleConstructorNotRedundant.kt");
}
@TestMetadata("simpleConstructorNotRedundantNotOptimizable.kt")
public void testSimpleConstructorNotRedundantNotOptimizable() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/deadCodeElimination/simpleConstructorNotRedundantNotOptimizable.kt");
}
}
@TestMetadata("compiler/testData/codegen/bytecodeText/defaultArguments")
@@ -3377,6 +3392,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/stringOperations/primitiveToString.kt");
}
@TestMetadata("primitiveToStringNotOptimizable.kt")
public void testPrimitiveToStringNotOptimizable() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/stringOperations/primitiveToStringNotOptimizable.kt");
}
@TestMetadata("primitivesAsStringTemplates.kt")
public void testPrimitivesAsStringTemplates() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/stringOperations/primitivesAsStringTemplates.kt");