[cli] Drop -Xverify-ir-visibility-after-inlining

Instead, use the `-Xverify-ir-visibility` flag for verifying visibility
after function inlining.

^KT-69009 Fixed
diff --git a/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArgumentsCopyGenerated.kt b/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArgumentsCopyGenerated.kt
index a06967d..5b1bdbd 100644
--- a/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArgumentsCopyGenerated.kt
+++ b/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArgumentsCopyGenerated.kt
@@ -86,7 +86,6 @@
     to.verbosePhases = from.verbosePhases?.copyOf()
     to.verifyIr = from.verifyIr
     to.verifyIrVisibility = from.verifyIrVisibility
-    to.verifyIrVisibilityAfterInlining = from.verifyIrVisibilityAfterInlining
     to.whenGuards = from.whenGuards
 
     return to
diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt
index 8b09388..c741dc2 100644
--- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt
+++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt
@@ -454,19 +454,6 @@
         }
 
     @Argument(
-        value = "-Xverify-ir-visibility-after-inlining",
-        description = """Check for visibility violations in IR when validating it after the function inlining phase.
-Only has effect if '-Xverify-ir' is not 'none'.
-This flag is deprecated and will soon be removed in favor of '-Xverify-ir-visibility'.
-""",
-    )
-    var verifyIrVisibilityAfterInlining: Boolean = false
-        set(value) {
-            checkFrozen()
-            field = value
-        }
-
-    @Argument(
         value = "-Xprofile-phases",
         description = "Profile backend phases."
     )
diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt
index cc7c38f..61dfa2c 100644
--- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt
+++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt
@@ -55,16 +55,6 @@
         }
     }
 
-    if (arguments.verifyIrVisibilityAfterInlining) {
-        put(CommonConfigurationKeys.ENABLE_IR_VISIBILITY_CHECKS_AFTER_INLINING, true)
-        if (irVerificationMode == IrVerificationMode.NONE) {
-            messageCollector.report(
-                CompilerMessageSeverity.WARNING,
-                "'-Xverify-ir-visibility-after-inlining' has no effect unless '-Xverify-ir=warning' or '-Xverify-ir=error' is specified"
-            )
-        }
-    }
-
     val metadataVersionString = arguments.metadataVersion
     if (metadataVersionString != null) {
         val versionArray = BinaryVersion.parseVersionArray(metadataVersionString)
diff --git a/compiler/config/src/org/jetbrains/kotlin/config/CommonConfigurationKeys.kt b/compiler/config/src/org/jetbrains/kotlin/config/CommonConfigurationKeys.kt
index 555acd5..3128dae 100644
--- a/compiler/config/src/org/jetbrains/kotlin/config/CommonConfigurationKeys.kt
+++ b/compiler/config/src/org/jetbrains/kotlin/config/CommonConfigurationKeys.kt
@@ -85,10 +85,6 @@
 
     @JvmField
     val ENABLE_IR_VISIBILITY_CHECKS = CompilerConfigurationKey.create<Boolean>("Check pre-lowering IR for visibility violations")
-
-    @JvmField
-    val ENABLE_IR_VISIBILITY_CHECKS_AFTER_INLINING =
-        CompilerConfigurationKey.create<Boolean>("Check post-inlining IR for visibility violations")
 }
 
 var CompilerConfiguration.languageVersionSettings: LanguageVersionSettings
diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/phaser/IrValidationPhase.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/phaser/IrValidationPhase.kt
index a86ff49..a823575 100644
--- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/phaser/IrValidationPhase.kt
+++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/phaser/IrValidationPhase.kt
@@ -66,10 +66,10 @@
     override val defaultValidationConfig: IrValidatorConfig
         get() = IrValidatorConfig(
             checkTypes = false, // TODO: Re-enable checking types (KT-68663)
-            checkValueScopes = context.configuration.getBoolean(CommonConfigurationKeys.ENABLE_IR_VISIBILITY_CHECKS_AFTER_INLINING),
-            checkCrossFileFieldUsage = context.configuration.getBoolean(CommonConfigurationKeys.ENABLE_IR_VISIBILITY_CHECKS_AFTER_INLINING),
+            checkValueScopes = context.configuration.getBoolean(CommonConfigurationKeys.ENABLE_IR_VISIBILITY_CHECKS),
+            checkCrossFileFieldUsage = context.configuration.getBoolean(CommonConfigurationKeys.ENABLE_IR_VISIBILITY_CHECKS),
             checkTypeParameterScopes = false,
-            checkVisibilities = context.configuration.getBoolean(CommonConfigurationKeys.ENABLE_IR_VISIBILITY_CHECKS_AFTER_INLINING),
+            checkVisibilities = context.configuration.getBoolean(CommonConfigurationKeys.ENABLE_IR_VISIBILITY_CHECKS),
             checkInlineFunctionUseSites = checkInlineFunctionCallSites
         )
 }
diff --git a/compiler/testData/cli/js/jsExtraHelp.out b/compiler/testData/cli/js/jsExtraHelp.out
index 60044c2e..d7c0545 100644
--- a/compiler/testData/cli/js/jsExtraHelp.out
+++ b/compiler/testData/cli/js/jsExtraHelp.out
@@ -161,11 +161,6 @@
   -Xverify-ir={none|warning|error}
                              IR verification mode (no verification by default).
   -Xverify-ir-visibility     Check for visibility violations in IR when validating it before running any lowerings. Only has effect if '-Xverify-ir' is not 'none'.
-  -Xverify-ir-visibility-after-inlining
-                             Check for visibility violations in IR when validating it after the function inlining phase.
-                             Only has effect if '-Xverify-ir' is not 'none'.
-                             This flag is deprecated and will soon be removed in favor of '-Xverify-ir-visibility'.
-
   -Xwhen-guards              Enable experimental language support for when guards.
 
 Advanced options are non-standard and may be changed or removed without any notice.
diff --git a/compiler/testData/cli/jvm/extraHelp.out b/compiler/testData/cli/jvm/extraHelp.out
index 8e663ff..025bc01 100644
--- a/compiler/testData/cli/jvm/extraHelp.out
+++ b/compiler/testData/cli/jvm/extraHelp.out
@@ -238,11 +238,6 @@
   -Xverify-ir={none|warning|error}
                              IR verification mode (no verification by default).
   -Xverify-ir-visibility     Check for visibility violations in IR when validating it before running any lowerings. Only has effect if '-Xverify-ir' is not 'none'.
-  -Xverify-ir-visibility-after-inlining
-                             Check for visibility violations in IR when validating it after the function inlining phase.
-                             Only has effect if '-Xverify-ir' is not 'none'.
-                             This flag is deprecated and will soon be removed in favor of '-Xverify-ir-visibility'.
-
   -Xwhen-guards              Enable experimental language support for when guards.
 
 Advanced options are non-standard and may be changed or removed without any notice.
diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/CodegenTestDirectives.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/CodegenTestDirectives.kt
index d6a6928..0f913d5 100644
--- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/CodegenTestDirectives.kt
+++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/CodegenTestDirectives.kt
@@ -271,18 +271,6 @@
         description = "Don't check for visibility violations when validating IR on the target backend"
     )
 
-    val ENABLE_IR_VISIBILITY_CHECKS_AFTER_INLINING by directive(
-        description = """
-        Check for visibility violation when validating IR after inlining.
-        Equivalent to passing the '-Xverify-ir-visibility-after-inlining' CLI flag.
-        
-        This directive is opt-in rather than opt-out (like $DISABLE_IR_VISIBILITY_CHECKS) because right now most test pass with
-        visibility checks enabled before lowering, but enabling these checks after inlining by default will cause most tests to fail,
-        because some lowerings that are run before inlining generate calls to internal intrinsics (KT-70295), and inlining in general may
-        cause visibility violations until we start generating synthetic accessors (KT-64865).
-        """.trimIndent()
-    )
-
     val ENABLE_DOUBLE_INLINING by directive(
         """
             Enable double-inlining for KLIB-based backend.
diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/CompilerConfigurationProvider.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/CompilerConfigurationProvider.kt
index 94675a0..47d19d8 100644
--- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/CompilerConfigurationProvider.kt
+++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/CompilerConfigurationProvider.kt
@@ -148,10 +148,6 @@
                 TargetBackend.ANY !in module.directives[CodegenTestDirectives.DISABLE_IR_VISIBILITY_CHECKS],
     )
     configuration.put(
-        CommonConfigurationKeys.ENABLE_IR_VISIBILITY_CHECKS_AFTER_INLINING,
-        CodegenTestDirectives.ENABLE_IR_VISIBILITY_CHECKS_AFTER_INLINING in module.directives
-    )
-    configuration.put(
         KlibConfigurationKeys.DOUBLE_INLINING_ENABLED,
         CodegenTestDirectives.ENABLE_DOUBLE_INLINING in module.directives
     )
diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/fir/AbstractJsFirTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/fir/AbstractJsFirTest.kt
index 70f91cc..292d9c4 100644
--- a/js/js.tests/test/org/jetbrains/kotlin/js/test/fir/AbstractJsFirTest.kt
+++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/fir/AbstractJsFirTest.kt
@@ -220,7 +220,6 @@
     override fun TestConfigurationBuilder.configuration() {
         commonConfigurationForJsBlackBoxCodegenTest()
         defaultDirectives {
-            +CodegenTestDirectives.ENABLE_IR_VISIBILITY_CHECKS_AFTER_INLINING
             +CodegenTestDirectives.ENABLE_DOUBLE_INLINING
             +CodegenTestDirectives.DUMP_KLIB_SYNTHETIC_ACCESSORS
             if (narrowedAccessorVisibility) +CodegenTestDirectives.KLIB_SYNTHETIC_ACCESSORS_WITH_NARROWED_VISIBILITY
diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/NativeTestSupport.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/NativeTestSupport.kt
index df39bf9..65fe6ae 100644
--- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/NativeTestSupport.kt
+++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/NativeTestSupport.kt
@@ -89,7 +89,6 @@
         val nativeTestInstances = computeKlibSyntheticAccessorTestInstances()
         val settings = createTestRunSettings(nativeTestInstances) {
             with(RegisteredDirectivesBuilder()) {
-                +CodegenTestDirectives.ENABLE_IR_VISIBILITY_CHECKS_AFTER_INLINING
                 +CodegenTestDirectives.DUMP_KLIB_SYNTHETIC_ACCESSORS
 
                 TestDirectives.FREE_COMPILER_ARGS with listOfNotNull(
diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/group/ExtTestCaseGroupProvider.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/group/ExtTestCaseGroupProvider.kt
index 6610fbf..8ffcd15 100644
--- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/group/ExtTestCaseGroupProvider.kt
+++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/group/ExtTestCaseGroupProvider.kt
@@ -183,11 +183,6 @@
         ) {
             args.add("-Xverify-ir-visibility")
         }
-        if (CodegenTestDirectives.ENABLE_IR_VISIBILITY_CHECKS_AFTER_INLINING in structure.directives ||
-            CodegenTestDirectives.ENABLE_IR_VISIBILITY_CHECKS_AFTER_INLINING in defaultDirectives
-        ) {
-            args.add("-Xverify-ir-visibility-after-inlining")
-        }
         args += "-opt-in=kotlin.native.internal.InternalForKotlinNative" // for `Any.isPermanent()` and `Any.isLocal()`
         args += "-opt-in=kotlin.native.internal.InternalForKotlinNativeTests" // for ReflectionPackageName
         val freeCInteropArgs = structure.directives.listValues(FREE_CINTEROP_ARGS.name)