[K/N] Fix tests failing because of phase renaming
This commit is contained in:
committed by
Space Team
parent
f3fd4b3e01
commit
c400a75407
@@ -357,10 +357,13 @@ The following values are supported:
|
||||
|
||||
The following compiler phases control different parts of LLVM pipeline:
|
||||
1. `LinkBitcodeDependencies`. Linkage of produced bitcode with runtime and some other dependencies.
|
||||
2. `BitcodeOptimization`. Running LLVM optimization pipeline.
|
||||
2. Running different parts of LLVM optimization pipeline:
|
||||
1. `MandatoryBitcodeLLVMPostprocessingPhase`: important postprocessing. Disabling can break generated code.
|
||||
2. `ModuleBitcodeOptimization`: Basic optimization pipeline. Something close to clang -O3
|
||||
3. `LTOBitcodeOptimization`: LTO pipeline. Slower, but better optimizations, assuming whole program knowlage.
|
||||
3. `ObjectFiles`. Compilation of bitcode with Clang.
|
||||
|
||||
For example, pass `-Xdisable-phases=BitcodeOptimization` to skip optimization pipeline.
|
||||
For example, pass `-Xdisable-phases=LTOBitcodeOptimization` to skip this part of optimization pipeline for faster compilation with slower code.
|
||||
Note that disabling `LinkBitcodeDependencies` or `ObjectFiles` will break compilation pipeline.
|
||||
|
||||
Compiler takes options for Clang from [konan.properties](konan/konan.properties) file
|
||||
@@ -375,7 +378,7 @@ Please note:
|
||||
#### Example: replace predefined LLVM pipeline with Clang options.
|
||||
```shell script
|
||||
CLANG_FLAGS="clangFlags.macos_x64=-cc1 -emit-obj;clangNooptFlags.macos_x64=-O2"
|
||||
kotlinc-native main.kt -Xdisable-phases=BitcodeOptimization -Xoverride-konan-properties="$CLANG_FLAGS"
|
||||
kotlinc-native main.kt -Xdisable-phases=MandatoryBitcodeLLVMPostprocessingPhase,ModuleBitcodeOptimization,LTOBitcodeOptimization -Xoverride-konan-properties="$CLANG_FLAGS"
|
||||
```
|
||||
|
||||
### Dumping LLVM IR
|
||||
|
||||
+9
-9
@@ -62,18 +62,17 @@ internal val RewriteExternalCallsCheckerGlobals = createSimpleNamedCompilerPhase
|
||||
|
||||
internal class OptimizationState(
|
||||
konanConfig: KonanConfig,
|
||||
val module: LLVMModuleRef,
|
||||
val llvmConfig: LlvmPipelineConfig
|
||||
) : BasicPhaseContext(konanConfig)
|
||||
|
||||
internal fun optimizationPipelinePass(name: String, description: String, pipeline: (LlvmPipelineConfig, LoggingContext) -> LlvmOptimizationPipeline) =
|
||||
createSimpleNamedCompilerPhase<OptimizationState, Unit>(
|
||||
createSimpleNamedCompilerPhase<OptimizationState, LLVMModuleRef>(
|
||||
name = name,
|
||||
description = description,
|
||||
postactions = getDefaultLlvmModuleActions(),
|
||||
) { context, _ ->
|
||||
) { context, module ->
|
||||
pipeline(context.llvmConfig, context).use {
|
||||
it.execute(context.module)
|
||||
it.execute(module)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,12 +164,13 @@ internal fun PhaseEngine<NativeGenerationState>.runBitcodePostProcessing() {
|
||||
closedWorld = context.llvmModuleSpecification.isFinal,
|
||||
timePasses = context.config.flexiblePhaseConfig.needProfiling,
|
||||
)
|
||||
useContext(OptimizationState(context.config, context.llvmModule, optimizationConfig)) {
|
||||
it.runPhase(MandatoryBitcodeLLVMPostprocessingPhase)
|
||||
it.runPhase(ModuleBitcodeOptimizationPhase)
|
||||
it.runPhase(LTOBitcodeOptimizationPhase)
|
||||
useContext(OptimizationState(context.config, optimizationConfig)) {
|
||||
val module = this@runBitcodePostProcessing.context.llvmModule
|
||||
it.runPhase(MandatoryBitcodeLLVMPostprocessingPhase, module)
|
||||
it.runPhase(ModuleBitcodeOptimizationPhase, module)
|
||||
it.runPhase(LTOBitcodeOptimizationPhase, module)
|
||||
when (context.config.sanitizer) {
|
||||
SanitizerKind.THREAD -> it.runPhase(ThreadSanitizerPhase)
|
||||
SanitizerKind.THREAD -> it.runPhase(ThreadSanitizerPhase, module)
|
||||
SanitizerKind.ADDRESS -> context.reportCompilationError("Address sanitizer is not supported yet")
|
||||
null -> {}
|
||||
}
|
||||
|
||||
@@ -6248,7 +6248,7 @@ tasks.register("override_konan_properties0", KonanDriverTest) {
|
||||
: '-Xoverride-konan-properties=llvmInlineThreshold=76'
|
||||
flags = [
|
||||
"-opt",
|
||||
"-Xverbose-phases=BitcodeOptimization",
|
||||
"-Xverbose-phases=MandatoryBitcodeLLVMPostprocessingPhase",
|
||||
overrides
|
||||
]
|
||||
compilerMessages = true
|
||||
@@ -6454,7 +6454,7 @@ if (HostManager.@Companion.hostIsMac) {
|
||||
targetName = "watchos_arm32"
|
||||
// Perform check after optimization pipeline because
|
||||
// LLVM might infer attributes.
|
||||
phaseToCheck = "BitcodeOptimization"
|
||||
phaseToCheck = "LTOBitcodeOptimization"
|
||||
}
|
||||
|
||||
fileCheckTest("filecheck_redundant_safepoints_removal_smallbinary") {
|
||||
|
||||
Reference in New Issue
Block a user