when: emit lookupswitch/tableswitch if possible
A lookupswitch or tableswitch can be used if all conditions are equality
checks to constants. To be more specific, it can be done if:
1. All conditions are CALL 'EQEQ(Any?, Any?)': Boolean
2. All types of variables involved in comparison are in the same group
of Char/Byte/Short/Int, String or enum.
3. All arg0 refer to the same value.
4. All arg1 are IrConst<*>.
Change-Id: Ifd7cb618395f6c5cc64601018b446f0bb7f5891c
This commit is contained in:
committed by
max-kammerer
parent
f5d0a38629
commit
c1d721a15f
@@ -3353,6 +3353,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/when/kt18818.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lookupSwitch.kt")
|
||||
public void testLookupSwitch() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/when/lookupSwitch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noBoxingInDefaultWhenWithSpecialCases.kt")
|
||||
public void testNoBoxingInDefaultWhenWithSpecialCases() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/when/noBoxingInDefaultWhenWithSpecialCases.kt");
|
||||
@@ -3393,6 +3398,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/when/subjectValInStringWhenHasLocalVariableSlot.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("tableSwitch.kt")
|
||||
public void testTableSwitch() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/when/tableSwitch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenNull.kt")
|
||||
public void testWhenNull() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/when/whenNull.kt");
|
||||
|
||||
Reference in New Issue
Block a user