From 0cd91d9286f85c21b0249c64a6eced8bafc115f2 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Wed, 6 Sep 2023 17:43:55 +0200 Subject: [PATCH] Native: fix filecheck_signext_zeroext_objc_export and enable it back Previously filecheck_signext_zeroext_objc_export test was disabled after making one-stage compilation mode implemented through two-stage mode (KT-59245). That change made the compiler sort the methods, and filecheck patterns didn't match that order after that. This commit fixes the test by adding sorted prefixes to method names, so sorting alphabetically them doesn't really change the order. --- .../backend.native/tests/build.gradle | 3 +- .../filecheck/signext_zeroext_objc_export.kt | 51 ++++++++++--------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle index e205ae22c08..6dd0c7ec206 100644 --- a/kotlin-native/backend.native/tests/build.gradle +++ b/kotlin-native/backend.native/tests/build.gradle @@ -6176,8 +6176,7 @@ fileCheckTest("filecheck_signext_zeroext_interop") { fileCheckTest("filecheck_signext_zeroext_objc_export") { annotatedSource = project.file('filecheck/signext_zeroext_objc_export.kt') generateFramework = true -// enabled = target.family.appleFamily - enabled = false // KT-58863 + enabled = target.family.appleFamily } fileCheckTest("filecheck_function_attributes_at_callsite") { diff --git a/kotlin-native/backend.native/tests/filecheck/signext_zeroext_objc_export.kt b/kotlin-native/backend.native/tests/filecheck/signext_zeroext_objc_export.kt index 43da3932413..1e14e29ee52 100644 --- a/kotlin-native/backend.native/tests/filecheck/signext_zeroext_objc_export.kt +++ b/kotlin-native/backend.native/tests/filecheck/signext_zeroext_objc_export.kt @@ -6,52 +6,55 @@ // // Here we check generated ObjC bridges, not original declarations. // +// f$n function name prefixes help the compiler keep the function order +// whenever it decides to sort the functions alphabetically. +// -// CHECK-LABEL: zeroext i16 @"objc2kotlin_kfun:#heyIJustMetYou(kotlin.Char){}kotlin.Char"(i8* %0, i8* %1, i16 zeroext %2) -fun heyIJustMetYou(arg: Char): Char { - // CHECK: invoke zeroext i16 @"kfun:#heyIJustMetYou(kotlin.Char){}kotlin.Char"(i16 zeroext %2) +// CHECK-LABEL: zeroext i16 @"objc2kotlin_kfun:#f0HeyIJustMetYou(kotlin.Char){}kotlin.Char"(i8* %0, i8* %1, i16 zeroext %2) +fun f0HeyIJustMetYou(arg: Char): Char { + // CHECK: invoke zeroext i16 @"kfun:#f0HeyIJustMetYou(kotlin.Char){}kotlin.Char"(i16 zeroext %2) return arg } -// CHECK-LABEL: signext i8 @"objc2kotlin_kfun:#andThisIsCrazy(kotlin.Byte){}kotlin.Byte"(i8* %0, i8* %1, i8 signext %2) -fun andThisIsCrazy(arg: Byte): Byte { - // CHECK: invoke signext i8 @"kfun:#andThisIsCrazy(kotlin.Byte){}kotlin.Byte"(i8 signext %2) +// CHECK-LABEL: signext i8 @"objc2kotlin_kfun:#f1AndThisIsCrazy(kotlin.Byte){}kotlin.Byte"(i8* %0, i8* %1, i8 signext %2) +fun f1AndThisIsCrazy(arg: Byte): Byte { + // CHECK: invoke signext i8 @"kfun:#f1AndThisIsCrazy(kotlin.Byte){}kotlin.Byte"(i8 signext %2) return arg } -// CHECK-LABEL: signext i16 @"objc2kotlin_kfun:#butHereIsMyNumber(kotlin.Short){}kotlin.Short"(i8* %0, i8* %1, i16 signext %2) -fun butHereIsMyNumber(arg: Short): Short { - // CHECK: invoke signext i16 @"kfun:#butHereIsMyNumber(kotlin.Short){}kotlin.Short"(i16 signext %2) +// CHECK-LABEL: signext i16 @"objc2kotlin_kfun:#f2ButHereIsMyNumber(kotlin.Short){}kotlin.Short"(i8* %0, i8* %1, i16 signext %2) +fun f2ButHereIsMyNumber(arg: Short): Short { + // CHECK: invoke signext i16 @"kfun:#f2ButHereIsMyNumber(kotlin.Short){}kotlin.Short"(i16 signext %2) return arg } -// CHECK-LABEL: signext i8 @"objc2kotlin_kfun:#soCallMeMaybe(kotlin.Boolean){}kotlin.Boolean"(i8* %0, i8* %1, i8 signext %2) -fun soCallMeMaybe(arg: Boolean): Boolean { - //CHECK: invoke zeroext i1 @"kfun:#soCallMeMaybe(kotlin.Boolean){}kotlin.Boolean"(i1 zeroext {{.*}}) +// CHECK-LABEL: signext i8 @"objc2kotlin_kfun:#f3SoCallMeMaybe(kotlin.Boolean){}kotlin.Boolean"(i8* %0, i8* %1, i8 signext %2) +fun f3SoCallMeMaybe(arg: Boolean): Boolean { + //CHECK: invoke zeroext i1 @"kfun:#f3SoCallMeMaybe(kotlin.Boolean){}kotlin.Boolean"(i1 zeroext {{.*}}) return arg } -// CHECK-LABEL: zeroext i8 @"objc2kotlin_kfun:#itsHardToLook(kotlin.UByte){}kotlin.UByte"(i8* %0, i8* %1, i8 zeroext %2) -fun itsHardToLook(arg: UByte): UByte { - // CHECK: invoke zeroext i8 @"kfun:#itsHardToLook(kotlin.UByte){}kotlin.UByte"(i8 zeroext %2) +// CHECK-LABEL: zeroext i8 @"objc2kotlin_kfun:#f4ItsHardToLook(kotlin.UByte){}kotlin.UByte"(i8* %0, i8* %1, i8 zeroext %2) +fun f4ItsHardToLook(arg: UByte): UByte { + // CHECK: invoke zeroext i8 @"kfun:#f4ItsHardToLook(kotlin.UByte){}kotlin.UByte"(i8 zeroext %2) return arg } -// CHECK-LABEL: zeroext i16 @"objc2kotlin_kfun:#rightAtYouBaby(kotlin.UShort){}kotlin.UShort"(i8* %0, i8* %1, i16 zeroext %2) -fun rightAtYouBaby(arg: UShort): UShort { - // CHECK: invoke zeroext i16 @"kfun:#rightAtYouBaby(kotlin.UShort){}kotlin.UShort"(i16 zeroext %2) +// CHECK-LABEL: zeroext i16 @"objc2kotlin_kfun:#f5RightAtYouBaby(kotlin.UShort){}kotlin.UShort"(i8* %0, i8* %1, i16 zeroext %2) +fun f5RightAtYouBaby(arg: UShort): UShort { + // CHECK: invoke zeroext i16 @"kfun:#f5RightAtYouBaby(kotlin.UShort){}kotlin.UShort"(i16 zeroext %2) return arg } -// CHECK-LABEL: float @"objc2kotlin_kfun:#butHereIsMyNumber1(kotlin.Float){}kotlin.Float"(i8* %0, i8* %1, float %2) -fun butHereIsMyNumber1(arg: Float): Float { - // CHECK: invoke float @"kfun:#butHereIsMyNumber1(kotlin.Float){}kotlin.Float"(float %2) +// CHECK-LABEL: float @"objc2kotlin_kfun:#f6ButHereIsMyNumber1(kotlin.Float){}kotlin.Float"(i8* %0, i8* %1, float %2) +fun f6ButHereIsMyNumber1(arg: Float): Float { + // CHECK: invoke float @"kfun:#f6ButHereIsMyNumber1(kotlin.Float){}kotlin.Float"(float %2) return arg } -// CHECK-LABEL: i8* @"objc2kotlin_kfun:#soCallMeMaybe1(kotlin.Any?){}kotlin.Any?"(i8* %0, i8* %1, i8* %2) -fun soCallMeMaybe1(arg: Any?): Any? { - // CHECK: invoke %struct.ObjHeader* @"kfun:#soCallMeMaybe1(kotlin.Any?){}kotlin.Any?"(%struct.ObjHeader* {{.*}}, %struct.ObjHeader** {{.*}}) +// CHECK-LABEL: i8* @"objc2kotlin_kfun:#f7SoCallMeMaybe1(kotlin.Any?){}kotlin.Any?"(i8* %0, i8* %1, i8* %2) +fun f7SoCallMeMaybe1(arg: Any?): Any? { + // CHECK: invoke %struct.ObjHeader* @"kfun:#f7SoCallMeMaybe1(kotlin.Any?){}kotlin.Any?"(%struct.ObjHeader* {{.*}}, %struct.ObjHeader** {{.*}}) return arg }