Skip to content

Conversation

@eeckstein
Copy link
Contributor

The driver splits the compile job into two jobs: one for creating the object file, one for emitting the swiftmodule.
For the swiftmodule-job the driver adds -experimental-skip-non-inlinable-function-bodies-without-types.
This breaks CMO, because in CMO, the inlinable-decision is not derived from the AST but done in the optimizer.

As a quick hack we could disable -experimental-skip-non-inlinable-function-bodies-without-types.
But for CMO, the two-job approach is highly problematic, because it risks the two compile jobs to get out of sync, e.g. by different command line options, indeterministic behavior, etc. This can result in unresolved symbol errors, which are very hard to debug.

This change also adds a new option -disable-cmo to disable cross-module-optimization. It can be used to go back to the old behavior.

rdar://89223981

@eeckstein eeckstein requested a review from artemcm February 21, 2022 14:16
@eeckstein
Copy link
Contributor Author

@swift-ci test

The driver splits the compile job into two jobs: one for creating the object file, one for emitting the swiftmodule.
For the swiftmodule-job the driver adds -experimental-skip-non-inlinable-function-bodies-without-types.
This breaks CMO, because in CMO, the inlinable-decision is not derived from the AST but done in the optimizer.

As a quick hack we could disable -experimental-skip-non-inlinable-function-bodies-without-types.
But for CMO, the two-job approach is highly problematic, because it risks the two compile jobs to get out of sync, e.g. by different command line options, indeterministic behavior, etc. This can result in unresolved symbol errors, which are very hard to debug.

This change also adds a new option `-disable-cmo` to disable cross-module-optimization. It can be used to go back to the old behavior.

rdar://89223981
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein requested review from nkcsgexi and xymus February 22, 2022 07:10
public static let continueBuildingAfterErrors: Option = Option("-continue-building-after-errors", .flag, attributes: [.frontend, .doesNotAffectIncrementalBuild], helpText: "Continue building, even after errors are encountered")
public static let coveragePrefixMap: Option = Option("-coverage-prefix-map", .separate, attributes: [.frontend], metaVar: "<prefix=replacement>", helpText: "Remap source paths in coverage info")
public static let CrossModuleOptimization: Option = Option("-cross-module-optimization", .flag, attributes: [.helpHidden, .frontend], helpText: "Perform cross-module optimization")
public static let disableCrossModuleOptimization: Option = Option("-disable-cmo", .flag, attributes: [.helpHidden, .frontend], helpText: "Disable cross-module optimization")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update Options.swift according to the procedure described in:
https://github.com/apple/swift-driver#rebuilding-optionsswift

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I'll do this in a separate PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants