[IR] Turned off IR validation for everything but our tests
This commit is contained in:
committed by
Stanislav Erokhin
parent
e5f7cef594
commit
606fbe37fc
@@ -183,6 +183,7 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
|
|||||||
|
|
||||||
if (arguments.verifyCompiler != null)
|
if (arguments.verifyCompiler != null)
|
||||||
put(VERIFY_COMPILER, arguments.verifyCompiler == "true")
|
put(VERIFY_COMPILER, arguments.verifyCompiler == "true")
|
||||||
|
put(VERIFY_IR, arguments.verifyIr)
|
||||||
put(VERIFY_BITCODE, arguments.verifyBitCode)
|
put(VERIFY_BITCODE, arguments.verifyBitCode)
|
||||||
|
|
||||||
put(ENABLED_PHASES,
|
put(ENABLED_PHASES,
|
||||||
|
|||||||
+3
@@ -225,6 +225,9 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
|
|||||||
@Argument(value = "-Xverify-bitcode", deprecatedName = "--verify_bitcode", description = "Verify llvm bitcode after each method")
|
@Argument(value = "-Xverify-bitcode", deprecatedName = "--verify_bitcode", description = "Verify llvm bitcode after each method")
|
||||||
var verifyBitCode: Boolean = false
|
var verifyBitCode: Boolean = false
|
||||||
|
|
||||||
|
@Argument(value = "-Xverify-ir", description = "Verify IR")
|
||||||
|
var verifyIr: Boolean = false
|
||||||
|
|
||||||
@Argument(value = "-Xverify-compiler", description = "Verify compiler")
|
@Argument(value = "-Xverify-compiler", description = "Verify compiler")
|
||||||
var verifyCompiler: String? = null
|
var verifyCompiler: String? = null
|
||||||
|
|
||||||
|
|||||||
+3
@@ -47,6 +47,9 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
|
|||||||
val memoryModel: MemoryModel get() = configuration.get(KonanConfigKeys.MEMORY_MODEL)!!
|
val memoryModel: MemoryModel get() = configuration.get(KonanConfigKeys.MEMORY_MODEL)!!
|
||||||
val destroyRuntimeMode: DestroyRuntimeMode get() = configuration.get(KonanConfigKeys.DESTROY_RUNTIME_MODE)!!
|
val destroyRuntimeMode: DestroyRuntimeMode get() = configuration.get(KonanConfigKeys.DESTROY_RUNTIME_MODE)!!
|
||||||
|
|
||||||
|
val needVerifyIr: Boolean
|
||||||
|
get() = configuration.get(KonanConfigKeys.VERIFY_IR) == true
|
||||||
|
|
||||||
val needCompilerVerification: Boolean
|
val needCompilerVerification: Boolean
|
||||||
get() = configuration.get(KonanConfigKeys.VERIFY_COMPILER) ?:
|
get() = configuration.get(KonanConfigKeys.VERIFY_COMPILER) ?:
|
||||||
(configuration.getBoolean(KonanConfigKeys.OPTIMIZATION) ||
|
(configuration.getBoolean(KonanConfigKeys.OPTIMIZATION) ||
|
||||||
|
|||||||
+2
@@ -126,6 +126,8 @@ class KonanConfigKeys {
|
|||||||
= CompilerConfigurationKey.create("directory for temporary files")
|
= CompilerConfigurationKey.create("directory for temporary files")
|
||||||
val VERIFY_BITCODE: CompilerConfigurationKey<Boolean>
|
val VERIFY_BITCODE: CompilerConfigurationKey<Boolean>
|
||||||
= CompilerConfigurationKey.create("verify bitcode")
|
= CompilerConfigurationKey.create("verify bitcode")
|
||||||
|
val VERIFY_IR: CompilerConfigurationKey<Boolean>
|
||||||
|
= CompilerConfigurationKey.create("verify IR")
|
||||||
val VERIFY_COMPILER: CompilerConfigurationKey<Boolean>
|
val VERIFY_COMPILER: CompilerConfigurationKey<Boolean>
|
||||||
= CompilerConfigurationKey.create("verify compiler")
|
= CompilerConfigurationKey.create("verify compiler")
|
||||||
val DEBUG_INFO_VERSION: CompilerConfigurationKey<Int>
|
val DEBUG_INFO_VERSION: CompilerConfigurationKey<Int>
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
|||||||
import org.jetbrains.kotlin.konan.target.CompilerOutputKind
|
import org.jetbrains.kotlin.konan.target.CompilerOutputKind
|
||||||
|
|
||||||
internal fun moduleValidationCallback(state: ActionState, module: IrModuleFragment, context: Context) {
|
internal fun moduleValidationCallback(state: ActionState, module: IrModuleFragment, context: Context) {
|
||||||
if (!context.config.needCompilerVerification) return
|
if (!context.config.needVerifyIr) return
|
||||||
|
|
||||||
val validatorConfig = IrValidatorConfig(
|
val validatorConfig = IrValidatorConfig(
|
||||||
abortOnError = false,
|
abortOnError = false,
|
||||||
|
|||||||
@@ -4872,6 +4872,7 @@ KotlinNativeTestKt.createTest(project, 'stdlibTest', KonanGTest) { task ->
|
|||||||
baseDir "$testOutputStdlib/stdlibTest"
|
baseDir "$testOutputStdlib/stdlibTest"
|
||||||
enableMultiplatform true
|
enableMultiplatform true
|
||||||
extraOpts '-tr',
|
extraOpts '-tr',
|
||||||
|
'-Xverify-ir',
|
||||||
'-Xopt-in=kotlin.RequiresOptIn,kotlin.ExperimentalStdlibApi',
|
'-Xopt-in=kotlin.RequiresOptIn,kotlin.ExperimentalStdlibApi',
|
||||||
"-friend-modules", project.rootProject.file("${project.properties['konan.home']}/klib/common/stdlib").absolutePath
|
"-friend-modules", project.rootProject.file("${project.properties['konan.home']}/klib/common/stdlib").absolutePath
|
||||||
extraOpts project.globalTestArgs
|
extraOpts project.globalTestArgs
|
||||||
@@ -4911,6 +4912,7 @@ task buildKonanTests { t ->
|
|||||||
srcFiles sources
|
srcFiles sources
|
||||||
baseDir testOutputLocal
|
baseDir testOutputLocal
|
||||||
extraOpts '-tr'
|
extraOpts '-tr'
|
||||||
|
extraOpts '-Xverify-ir'
|
||||||
extraOpts project.globalTestArgs
|
extraOpts project.globalTestArgs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class RunExternalTestGroup extends JavaExec {
|
|||||||
def dist = UtilsKt.getKotlinNativeDist(project)
|
def dist = UtilsKt.getKotlinNativeDist(project)
|
||||||
|
|
||||||
def enableKonanAssertions = true
|
def enableKonanAssertions = true
|
||||||
|
def verifyIr = true
|
||||||
String outputDirectory = null
|
String outputDirectory = null
|
||||||
String goldValue = null
|
String goldValue = null
|
||||||
// Checks test's output against gold value and returns true if the output matches the expectation
|
// Checks test's output against gold value and returns true if the output matches the expectation
|
||||||
@@ -100,6 +101,9 @@ class RunExternalTestGroup extends JavaExec {
|
|||||||
if (enableKonanAssertions) {
|
if (enableKonanAssertions) {
|
||||||
args "-ea"
|
args "-ea"
|
||||||
}
|
}
|
||||||
|
if (verifyIr) {
|
||||||
|
args "-Xverify-ir"
|
||||||
|
}
|
||||||
if (project.hasProperty("test_verbose")) {
|
if (project.hasProperty("test_verbose")) {
|
||||||
println("Files to compile: $filesToCompile")
|
println("Files to compile: $filesToCompile")
|
||||||
println(args)
|
println(args)
|
||||||
|
|||||||
@@ -333,11 +333,21 @@ open class KonanStandaloneTest : KonanLocalTest() {
|
|||||||
@Input @Optional
|
@Input @Optional
|
||||||
var enableKonanAssertions = true
|
var enableKonanAssertions = true
|
||||||
|
|
||||||
|
@Input @Optional
|
||||||
|
var verifyIr = true
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compiler flags used to build a test.
|
* Compiler flags used to build a test.
|
||||||
*/
|
*/
|
||||||
var flags: List<String> = listOf()
|
var flags: List<String> = listOf()
|
||||||
get() = if (enableKonanAssertions) field + "-ea" else field
|
get() {
|
||||||
|
val result = field.toMutableList()
|
||||||
|
if (enableKonanAssertions)
|
||||||
|
result += "-ea"
|
||||||
|
if (verifyIr)
|
||||||
|
result += "-Xverify-ir"
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
fun getSources(): Provider<List<String>> = project.provider {
|
fun getSources(): Provider<List<String>> = project.provider {
|
||||||
val sources = buildCompileList(project.file(source).toPath(), outputDirectory)
|
val sources = buildCompileList(project.file(source).toPath(), outputDirectory)
|
||||||
|
|||||||
Reference in New Issue
Block a user