[K/N] Migrate filecheck test redundant_safepoints to new infra
^KT-62157
This commit is contained in:
committed by
Space Team
parent
35b83a1225
commit
35e5b0613d
+6
@@ -19480,6 +19480,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo
|
||||
runTest("compiler/testData/codegen/box/fileCheck/no_frame_on_constant_object_access.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redundant_safepoints.kt")
|
||||
public void testRedundant_safepoints() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/redundant_safepoints.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("replace_invoke_with_call.kt")
|
||||
public void testReplace_invoke_with_call() throws Exception {
|
||||
|
||||
+6
@@ -19480,6 +19480,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi
|
||||
runTest("compiler/testData/codegen/box/fileCheck/no_frame_on_constant_object_access.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redundant_safepoints.kt")
|
||||
public void testRedundant_safepoints() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/redundant_safepoints.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("replace_invoke_with_call.kt")
|
||||
public void testReplace_invoke_with_call() throws Exception {
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FILECHECK_STAGE: RemoveRedundantSafepoints
|
||||
|
||||
// This test checks:
|
||||
// - there is only one safepoint per function
|
||||
// - safepoint function is inlined in OPT mode, unless SMALLBINARY is needed (for ex, watchos_arm32)
|
||||
// Might fail under -Xbinary=gc=stwms and -Xbinary=gc=noop. In this case, just add ignore clause.
|
||||
|
||||
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
import kotlin.native.Retain
|
||||
|
||||
class C
|
||||
|
||||
fun f(): Any {
|
||||
return C()
|
||||
}
|
||||
|
||||
fun g() = f()
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#h(kotlin.Boolean){}kotlin.Any"
|
||||
@Retain
|
||||
fun h(cond: Boolean): Any {
|
||||
// CHECK-SMALLBINARY: {{call .*Kotlin_mm_safePointFunctionPrologue}}
|
||||
// CHECK-BIGBINARY-OPT: _ZN12_GLOBAL__N_115safePointActionE
|
||||
|
||||
// CHECK-SMALLBINARY-NOT: _ZN12_GLOBAL__N_115safePointActionE
|
||||
// CHECK-BIGBINARY-OPT-NOT: {{call .*Kotlin_mm_safePointFunctionPrologue}}
|
||||
|
||||
// CHECK-SMALLBINARY-NOT: {{call .*Kotlin_mm_safePointFunctionPrologue}}
|
||||
// CHECK-BIGBINARY-OPT-NOT: _ZN12_GLOBAL__N_115safePointActionE
|
||||
if (cond) {
|
||||
return listOf(C(), C())
|
||||
} else {
|
||||
return listOf(C(), C(), C())
|
||||
}
|
||||
// CHECK-LABEL: ret
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#box(){}kotlin.String"
|
||||
@Retain
|
||||
fun box(): String {
|
||||
// CHECK-SMALLBINARY: {{call .*Kotlin_mm_safePointFunctionPrologue}}
|
||||
// CHECK-BIGBINARY-OPT: _ZN12_GLOBAL__N_115safePointActionE
|
||||
|
||||
// CHECK-SMALLBINARY-NOT: _ZN12_GLOBAL__N_115safePointActionE
|
||||
// CHECK-BIGBINARY-OPT-NOT: {{call .*Kotlin_mm_safePointFunctionPrologue}}
|
||||
|
||||
// CHECK-SMALLBINARY-NOT: {{call .*Kotlin_mm_safePointFunctionPrologue}}
|
||||
// CHECK-BIGBINARY-OPT-NOT: _ZN12_GLOBAL__N_115safePointActionE
|
||||
println(g())
|
||||
println(h(true))
|
||||
return "OK"
|
||||
// CHECK-LABEL: ret
|
||||
}
|
||||
@@ -2975,26 +2975,6 @@ Task fileCheckTest(String name, Closure<FileCheckTest> configureClosure) {
|
||||
}
|
||||
}
|
||||
|
||||
if (HostManager.@Companion.hostIsMac) {
|
||||
fileCheckTest("filecheck_redundant_safepoints_removal_smallbinary") {
|
||||
enabled = project.globalTestArgs.contains("-opt")
|
||||
annotatedSource = project.file('filecheck/redundant_safepoints.kt')
|
||||
targetName = "watchos_arm32"
|
||||
checkPrefix = "CHECK-SMALLBINARY"
|
||||
extraOpts = ["-opt"]
|
||||
phaseToCheck = "RemoveRedundantSafepoints"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_redundant_safepoints_removal") {
|
||||
enabled = !isNoopGC && !isSTWMSGC &&
|
||||
project.globalTestArgs.contains("-opt") &&
|
||||
!PlatformInfo.needSmallBinary(project)
|
||||
annotatedSource = project.file('filecheck/redundant_safepoints.kt')
|
||||
phaseToCheck = "RemoveRedundantSafepoints"
|
||||
}
|
||||
|
||||
createInterop("filecheck_signext_zeroext_interop_input") {
|
||||
it.defFile 'filecheck/signext_zeroext_interop_input.def'
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
import kotlin.native.Retain
|
||||
|
||||
class C
|
||||
|
||||
fun f(): Any {
|
||||
return C()
|
||||
}
|
||||
|
||||
fun g() = f()
|
||||
|
||||
// CHECK-LABEL: define %struct.ObjHeader* @"kfun:#h(kotlin.Boolean){}kotlin.Any"
|
||||
@Retain
|
||||
fun h(cond: Boolean): Any {
|
||||
// CHECK: _ZN12_GLOBAL__N_115safePointActionE
|
||||
// CHECK-SMALLBINARY: {{call .*Kotlin_mm_safePointFunctionPrologue}}
|
||||
// CHECK-NOT: _ZN12_GLOBAL__N_115safePointActionE
|
||||
// CHECK-NOT: {{call .*Kotlin_mm_safePointFunctionPrologue}}
|
||||
// CHECK: br
|
||||
// CHECK-SMALLBINARY: br
|
||||
if (cond) {
|
||||
// CHECK-NOT: _ZN12_GLOBAL__N_115safePointActionE
|
||||
// CHECK-NOT: {{call .*Kotlin_mm_safePointFunctionPrologue}}
|
||||
// CHECK: br
|
||||
// CHECK-SMALLBINARY: br
|
||||
return listOf(C(), C())
|
||||
} else {
|
||||
// CHECK-NOT: _ZN12_GLOBAL__N_115safePointActionE
|
||||
// CHECK-NOT: {{call .*Kotlin_mm_safePointFunctionPrologue}}
|
||||
return listOf(C(), C(), C())
|
||||
}
|
||||
// CHECK: }
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define void @"kfun:#main(){}"()
|
||||
@Retain
|
||||
fun main() {
|
||||
// CHECK: _ZN12_GLOBAL__N_115safePointActionE
|
||||
// CHECK-SMALLBINARY: {{call .*Kotlin_mm_safePointFunctionPrologue}}
|
||||
// CHECK-NOT: _ZN12_GLOBAL__N_115safePointActionE
|
||||
// CHECK-NOT: {{call .*Kotlin_mm_safePointFunctionPrologue}}
|
||||
println(g())
|
||||
println(h(true))
|
||||
// CHECK: }
|
||||
}
|
||||
+6
@@ -15827,6 +15827,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
|
||||
runTest("compiler/testData/codegen/box/fileCheck/no_frame_on_constant_object_access.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redundant_safepoints.kt")
|
||||
public void testRedundant_safepoints() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/redundant_safepoints.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("replace_invoke_with_call.kt")
|
||||
public void testReplace_invoke_with_call() throws Exception {
|
||||
|
||||
+6
@@ -16195,6 +16195,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
|
||||
runTest("compiler/testData/codegen/box/fileCheck/no_frame_on_constant_object_access.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redundant_safepoints.kt")
|
||||
public void testRedundant_safepoints() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/redundant_safepoints.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("replace_invoke_with_call.kt")
|
||||
public void testReplace_invoke_with_call() throws Exception {
|
||||
|
||||
+6
@@ -15459,6 +15459,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
runTest("compiler/testData/codegen/box/fileCheck/no_frame_on_constant_object_access.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redundant_safepoints.kt")
|
||||
public void testRedundant_safepoints() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/redundant_safepoints.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("replace_invoke_with_call.kt")
|
||||
public void testReplace_invoke_with_call() throws Exception {
|
||||
|
||||
+6
@@ -15828,6 +15828,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
|
||||
runTest("compiler/testData/codegen/box/fileCheck/no_frame_on_constant_object_access.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("redundant_safepoints.kt")
|
||||
public void testRedundant_safepoints() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fileCheck/redundant_safepoints.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("replace_invoke_with_call.kt")
|
||||
public void testReplace_invoke_with_call() throws Exception {
|
||||
|
||||
+6
@@ -10,6 +10,7 @@ import com.intellij.openapi.util.text.StringUtilRt.convertLineSeparators
|
||||
import kotlinx.coroutines.*
|
||||
import org.jetbrains.kotlin.konan.target.Architecture
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.konan.target.needSmallBinary
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.TestCaseId
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.runner.AbstractRunner.AbstractRun
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.runner.TestRunCheck.ExecutionTimeout
|
||||
@@ -170,6 +171,11 @@ internal abstract class LocalResultHandler<R>(
|
||||
if (testTarget.family.isAppleFamily) {
|
||||
add("CHECK-APPLE")
|
||||
}
|
||||
if (testTarget.needSmallBinary()) {
|
||||
add("CHECK-SMALLBINARY")
|
||||
} else {
|
||||
add("CHECK-BIGBINARY")
|
||||
}
|
||||
}
|
||||
val optimizationMode = check.settings.get<OptimizationMode>().name
|
||||
val checkPrefixesWithOptMode = checkPrefixes.map { "$it-$optimizationMode" }
|
||||
|
||||
Reference in New Issue
Block a user