[IR] Support const optimizations for Native backend

This commit is contained in:
Ivan Kylchik
2023-05-29 00:19:47 +02:00
committed by Space Team
parent 6e6a4d6411
commit ad6332112e
31 changed files with 352 additions and 34 deletions
@@ -23930,6 +23930,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
runTest("compiler/testData/codegen/box/involvesIrInterpreter/longOperations.kt");
}
@Test
@TestMetadata("objectConstValInAnnotationArgument.kt")
public void testObjectConstValInAnnotationArgument() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/objectConstValInAnnotationArgument.kt");
}
@Test
@TestMetadata("shortOperations.kt")
public void testShortOperations() throws Exception {
@@ -23960,12 +23966,30 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
runTest("compiler/testData/codegen/box/involvesIrInterpreter/stringOperations.kt");
}
@Test
@TestMetadata("thisPlusString.kt")
public void testThisPlusString() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/thisPlusString.kt");
}
@Test
@TestMetadata("thisPlusStringWithObject.kt")
public void testThisPlusStringWithObject() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/thisPlusStringWithObject.kt");
}
@Test
@TestMetadata("unsignedConst.kt")
public void testUnsignedConst() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/unsignedConst.kt");
}
@Test
@TestMetadata("useCorrectToString.kt")
public void testUseCorrectToString() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -23978,11 +24002,65 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("constTrimIndent.kt")
public void testConstTrimIndent() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimIndent.kt");
}
@Test
@TestMetadata("constTrimMargin.kt")
public void testConstTrimMargin() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimMargin.kt");
}
@Test
@TestMetadata("enumName.kt")
public void testEnumName() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumName.kt");
}
@Test
@TestMetadata("enumNameWithInit.kt")
public void testEnumNameWithInit() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumNameWithInit.kt");
}
@Test
@TestMetadata("equals_after.kt")
public void testEquals_after() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/equals_after.kt");
}
@Test
@TestMetadata("ifConstVal.kt")
public void testIfConstVal() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/ifConstVal.kt");
}
@Test
@TestMetadata("kCallableName.kt")
public void testKCallableName() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableName.kt");
}
@Test
@TestMetadata("kCallableNameWithSideEffect.kt")
public void testKCallableNameWithSideEffect() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableNameWithSideEffect.kt");
}
@Test
@TestMetadata("kt53272.kt")
public void testKt53272() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt53272.kt");
}
@Test
@TestMetadata("kt58717.kt")
public void testKt58717() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt");
}
}
@Nested
@@ -24394,6 +24394,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
runTest("compiler/testData/codegen/box/involvesIrInterpreter/longOperations.kt");
}
@Test
@TestMetadata("objectConstValInAnnotationArgument.kt")
public void testObjectConstValInAnnotationArgument() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/objectConstValInAnnotationArgument.kt");
}
@Test
@TestMetadata("shortOperations.kt")
public void testShortOperations() throws Exception {
@@ -24424,12 +24430,30 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
runTest("compiler/testData/codegen/box/involvesIrInterpreter/stringOperations.kt");
}
@Test
@TestMetadata("thisPlusString.kt")
public void testThisPlusString() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/thisPlusString.kt");
}
@Test
@TestMetadata("thisPlusStringWithObject.kt")
public void testThisPlusStringWithObject() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/thisPlusStringWithObject.kt");
}
@Test
@TestMetadata("unsignedConst.kt")
public void testUnsignedConst() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/unsignedConst.kt");
}
@Test
@TestMetadata("useCorrectToString.kt")
public void testUseCorrectToString() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -24444,11 +24468,65 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("constTrimIndent.kt")
public void testConstTrimIndent() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimIndent.kt");
}
@Test
@TestMetadata("constTrimMargin.kt")
public void testConstTrimMargin() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimMargin.kt");
}
@Test
@TestMetadata("enumName.kt")
public void testEnumName() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumName.kt");
}
@Test
@TestMetadata("enumNameWithInit.kt")
public void testEnumNameWithInit() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumNameWithInit.kt");
}
@Test
@TestMetadata("equals_after.kt")
public void testEquals_after() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/equals_after.kt");
}
@Test
@TestMetadata("ifConstVal.kt")
public void testIfConstVal() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/ifConstVal.kt");
}
@Test
@TestMetadata("kCallableName.kt")
public void testKCallableName() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableName.kt");
}
@Test
@TestMetadata("kCallableNameWithSideEffect.kt")
public void testKCallableNameWithSideEffect() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableNameWithSideEffect.kt");
}
@Test
@TestMetadata("kt53272.kt")
public void testKt53272() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt53272.kt");
}
@Test
@TestMetadata("kt58717.kt")
public void testKt58717() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt");
}
}
@Nested
@@ -23699,6 +23699,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
runTest("compiler/testData/codegen/box/involvesIrInterpreter/longOperations.kt");
}
@Test
@TestMetadata("objectConstValInAnnotationArgument.kt")
public void testObjectConstValInAnnotationArgument() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/objectConstValInAnnotationArgument.kt");
}
@Test
@TestMetadata("shortOperations.kt")
public void testShortOperations() throws Exception {
@@ -23729,12 +23735,30 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
runTest("compiler/testData/codegen/box/involvesIrInterpreter/stringOperations.kt");
}
@Test
@TestMetadata("thisPlusString.kt")
public void testThisPlusString() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/thisPlusString.kt");
}
@Test
@TestMetadata("thisPlusStringWithObject.kt")
public void testThisPlusStringWithObject() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/thisPlusStringWithObject.kt");
}
@Test
@TestMetadata("unsignedConst.kt")
public void testUnsignedConst() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/unsignedConst.kt");
}
@Test
@TestMetadata("useCorrectToString.kt")
public void testUseCorrectToString() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -23746,11 +23770,65 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("constTrimIndent.kt")
public void testConstTrimIndent() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimIndent.kt");
}
@Test
@TestMetadata("constTrimMargin.kt")
public void testConstTrimMargin() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimMargin.kt");
}
@Test
@TestMetadata("enumName.kt")
public void testEnumName() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumName.kt");
}
@Test
@TestMetadata("enumNameWithInit.kt")
public void testEnumNameWithInit() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumNameWithInit.kt");
}
@Test
@TestMetadata("equals_after.kt")
public void testEquals_after() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/equals_after.kt");
}
@Test
@TestMetadata("ifConstVal.kt")
public void testIfConstVal() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/ifConstVal.kt");
}
@Test
@TestMetadata("kCallableName.kt")
public void testKCallableName() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableName.kt");
}
@Test
@TestMetadata("kCallableNameWithSideEffect.kt")
public void testKCallableNameWithSideEffect() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableNameWithSideEffect.kt");
}
@Test
@TestMetadata("kt53272.kt")
public void testKt53272() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt53272.kt");
}
@Test
@TestMetadata("kt58717.kt")
public void testKt58717() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt");
}
}
@Nested
@@ -23931,6 +23931,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
runTest("compiler/testData/codegen/box/involvesIrInterpreter/longOperations.kt");
}
@Test
@TestMetadata("objectConstValInAnnotationArgument.kt")
public void testObjectConstValInAnnotationArgument() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/objectConstValInAnnotationArgument.kt");
}
@Test
@TestMetadata("shortOperations.kt")
public void testShortOperations() throws Exception {
@@ -23961,12 +23967,30 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
runTest("compiler/testData/codegen/box/involvesIrInterpreter/stringOperations.kt");
}
@Test
@TestMetadata("thisPlusString.kt")
public void testThisPlusString() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/thisPlusString.kt");
}
@Test
@TestMetadata("thisPlusStringWithObject.kt")
public void testThisPlusStringWithObject() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/thisPlusStringWithObject.kt");
}
@Test
@TestMetadata("unsignedConst.kt")
public void testUnsignedConst() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/unsignedConst.kt");
}
@Test
@TestMetadata("useCorrectToString.kt")
public void testUseCorrectToString() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -23979,11 +24003,65 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("constTrimIndent.kt")
public void testConstTrimIndent() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimIndent.kt");
}
@Test
@TestMetadata("constTrimMargin.kt")
public void testConstTrimMargin() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimMargin.kt");
}
@Test
@TestMetadata("enumName.kt")
public void testEnumName() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumName.kt");
}
@Test
@TestMetadata("enumNameWithInit.kt")
public void testEnumNameWithInit() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumNameWithInit.kt");
}
@Test
@TestMetadata("equals_after.kt")
public void testEquals_after() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/equals_after.kt");
}
@Test
@TestMetadata("ifConstVal.kt")
public void testIfConstVal() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/ifConstVal.kt");
}
@Test
@TestMetadata("kCallableName.kt")
public void testKCallableName() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableName.kt");
}
@Test
@TestMetadata("kCallableNameWithSideEffect.kt")
public void testKCallableNameWithSideEffect() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableNameWithSideEffect.kt");
}
@Test
@TestMetadata("kt53272.kt")
public void testKt53272() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt53272.kt");
}
@Test
@TestMetadata("kt58717.kt")
public void testKt58717() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt");
}
}
@Nested