[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)
|
||||
put(VERIFY_COMPILER, arguments.verifyCompiler == "true")
|
||||
put(VERIFY_IR, arguments.verifyIr)
|
||||
put(VERIFY_BITCODE, arguments.verifyBitCode)
|
||||
|
||||
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")
|
||||
var verifyBitCode: Boolean = false
|
||||
|
||||
@Argument(value = "-Xverify-ir", description = "Verify IR")
|
||||
var verifyIr: Boolean = false
|
||||
|
||||
@Argument(value = "-Xverify-compiler", description = "Verify compiler")
|
||||
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 destroyRuntimeMode: DestroyRuntimeMode get() = configuration.get(KonanConfigKeys.DESTROY_RUNTIME_MODE)!!
|
||||
|
||||
val needVerifyIr: Boolean
|
||||
get() = configuration.get(KonanConfigKeys.VERIFY_IR) == true
|
||||
|
||||
val needCompilerVerification: Boolean
|
||||
get() = configuration.get(KonanConfigKeys.VERIFY_COMPILER) ?:
|
||||
(configuration.getBoolean(KonanConfigKeys.OPTIMIZATION) ||
|
||||
|
||||
+2
@@ -126,6 +126,8 @@ class KonanConfigKeys {
|
||||
= CompilerConfigurationKey.create("directory for temporary files")
|
||||
val VERIFY_BITCODE: CompilerConfigurationKey<Boolean>
|
||||
= CompilerConfigurationKey.create("verify bitcode")
|
||||
val VERIFY_IR: CompilerConfigurationKey<Boolean>
|
||||
= CompilerConfigurationKey.create("verify IR")
|
||||
val VERIFY_COMPILER: CompilerConfigurationKey<Boolean>
|
||||
= CompilerConfigurationKey.create("verify compiler")
|
||||
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
|
||||
|
||||
internal fun moduleValidationCallback(state: ActionState, module: IrModuleFragment, context: Context) {
|
||||
if (!context.config.needCompilerVerification) return
|
||||
if (!context.config.needVerifyIr) return
|
||||
|
||||
val validatorConfig = IrValidatorConfig(
|
||||
abortOnError = false,
|
||||
|
||||
@@ -4872,6 +4872,7 @@ KotlinNativeTestKt.createTest(project, 'stdlibTest', KonanGTest) { task ->
|
||||
baseDir "$testOutputStdlib/stdlibTest"
|
||||
enableMultiplatform true
|
||||
extraOpts '-tr',
|
||||
'-Xverify-ir',
|
||||
'-Xopt-in=kotlin.RequiresOptIn,kotlin.ExperimentalStdlibApi',
|
||||
"-friend-modules", project.rootProject.file("${project.properties['konan.home']}/klib/common/stdlib").absolutePath
|
||||
extraOpts project.globalTestArgs
|
||||
@@ -4911,6 +4912,7 @@ task buildKonanTests { t ->
|
||||
srcFiles sources
|
||||
baseDir testOutputLocal
|
||||
extraOpts '-tr'
|
||||
extraOpts '-Xverify-ir'
|
||||
extraOpts project.globalTestArgs
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ class RunExternalTestGroup extends JavaExec {
|
||||
def dist = UtilsKt.getKotlinNativeDist(project)
|
||||
|
||||
def enableKonanAssertions = true
|
||||
def verifyIr = true
|
||||
String outputDirectory = null
|
||||
String goldValue = null
|
||||
// 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) {
|
||||
args "-ea"
|
||||
}
|
||||
if (verifyIr) {
|
||||
args "-Xverify-ir"
|
||||
}
|
||||
if (project.hasProperty("test_verbose")) {
|
||||
println("Files to compile: $filesToCompile")
|
||||
println(args)
|
||||
|
||||
@@ -333,11 +333,21 @@ open class KonanStandaloneTest : KonanLocalTest() {
|
||||
@Input @Optional
|
||||
var enableKonanAssertions = true
|
||||
|
||||
@Input @Optional
|
||||
var verifyIr = true
|
||||
|
||||
/**
|
||||
* Compiler flags used to build a test.
|
||||
*/
|
||||
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 {
|
||||
val sources = buildCompileList(project.file(source).toPath(), outputDirectory)
|
||||
|
||||
Reference in New Issue
Block a user