swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.69k stars 1.33k forks source link

[SR-13487] SwiftPM: Allow customizing optimization level #4502

Open benlangmuir opened 4 years ago

benlangmuir commented 4 years ago
Previous ID SR-13487
Radar rdar://problem/68172740
Original Reporter @benlangmuir
Type Bug
Environment 5.3, Xcode 12
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Package Manager | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: b1aca7b2908f3273e1e306847e76442d

Issue Description:

Currently swift build -c release uses -O for swift and -O2 for C, and building a package in Xcode uses -O for swift and -Os for C.

We should be able to customize the optimization level of release builds.

Swift supports:

-Onone, -O, -Osize, -Ounchecked
-whole-module-optimization, -no-whole-module-optimization

Clang supports:

-O0, -O1, -O2, -O3, -Ofast, -Os, -Oz, -Og
-flto, -flto=full, -flto=thin
benlangmuir commented 4 years ago

@swift-ci create