Skip to content

Swift: Update default build flags

Fully-optimized builds should be using whole-module optimizations(WMO) to get all the optimizations the compiler can do for a given module. As such, it makes sense for the release builds to pass -whole-module-optimization or -wmo to the compiler by default.

Removing '-incremental ' from the CMAKE_Swift_CREATE_* variable: WMO is incompatible with incremental builds, so I am removing the incremental flag from the 'CMAKE_Swift_CREATE_*' and adding it to the default debug build flags.

Pass -num-threads to the driver in CMAKE_Swift_CREATE_*: WMO mode doesn't use the -j flag, but instead uses -num-threads to get parallelism. The two flags are applicable in mutually exclusive contexts, so -j N is a no-op in WMO mode, and -num-threads is a no-op in other modes, so passing both at the same time will catch both cases.

Topic-rename: swift-default-flags

Edited by Brad King

Merge request reports