[JVM IR] Use append(Char) for 1-length string literals in string

templates and plus concatenations.

This is slightly more efficient and mirrors the behavior of the non-IR
backend for templates (but not for plus concatenations).

#KT-36638 Fixed
This commit is contained in:
Mark Punzalan
2020-02-12 11:26:59 -08:00
committed by Dmitry Petrov
parent bd9877cc62
commit 4234fa79c0
9 changed files with 78 additions and 17 deletions
@@ -4249,6 +4249,21 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
public void testStringPlus() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/stringOperations/stringPlus.kt");
}
@TestMetadata("useAppendCharForOneCharStringInTemplate.kt")
public void testUseAppendCharForOneCharStringInTemplate() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/stringOperations/useAppendCharForOneCharStringInTemplate.kt");
}
@TestMetadata("useAppendCharForOneCharStringInTemplate_2.kt")
public void testUseAppendCharForOneCharStringInTemplate_2() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/stringOperations/useAppendCharForOneCharStringInTemplate_2.kt");
}
@TestMetadata("useAppendCharForOneCharStringUsingPlus.kt")
public void testUseAppendCharForOneCharStringUsingPlus() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/stringOperations/useAppendCharForOneCharStringUsingPlus.kt");
}
}
@TestMetadata("compiler/testData/codegen/bytecodeText/toArray")