What it does:
Issuing the command swift build -c release -Ounchecked does not result in a build with runtime safety checks removed.
According to BuildPlan.swift, the default optimization arguments for the build configuration (either -Onone -g -enable-testing for debug builds or -O for release builds) always come after the options specified on the command-line, causing the developer-specified options for optimizations to be overridden.
In addition, -j<threads> is also overridden as well as others.
What it should do:
According to the swift build --help the option -Xswiftc is documented as Pass flag through to all Swift compiler invocations. As no exceptions are specified, it is assumed that all options are passed through, including those for optimizations.
Ideally, the developer-specified command-line options last on the command line to avoid confusion. If this is not possible for all options, then a warning should be presented to inform the developer that their option has been overridden.