Open
Description
Description
I'm encountering problems while building the release version of my project. The debug version builds fine using the -Onone option, but when I try to build the release version using the -O option, I'm running into issues.
Specifically, there are a couple of Swift files that cannot be built with the -O option, such as those containing extension URL. I'm unsure of how to resolve this issue and would appreciate any advice or guidance on how to proceed.
Steps to reproduce
URL+Extension.swift <- can't build
extension URL {
var queryDictionary: [String: String]? {
var dic = [String: String]()
if let items = URLComponents(string: absoluteString)?.queryItems {
for item in items {
if let value = item.value {
dic[item.name] = value
}
}
}
return dic.isEmpty ? nil : dic
}
}
log
4. While evaluating request ExecuteSILPipelineRequest(Run pipelines { PrepareOptimizationPasses, EarlyModulePasses, HighLevel,Function+EarlyLoopOpt, HighLevel,Module+StackPromote, MidLevel,Function, ClosureSpecialize, LowLevel,Function, LateLoopOpt, SIL Debug Info Generator } on SIL for NinetyNine)
5. While running pass #17357670 SILModuleTransform "DeadFunctionAndGlobalElimination".
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x0000000107b23300 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x0000000107b222e4 llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x0000000107b23910 SignalHandler(int) + 344
3 libsystem_platform.dylib 0x000000018aeeea84 _sigtramp + 56
4 swift-frontend 0x000000010325f65c (anonymous namespace)::DeadFunctionAndGlobalEliminationPass::run() + 424
5 swift-frontend 0x000000010325f65c (anonymous namespace)::DeadFunctionAndGlobalEliminationPass::run() + 424
6 swift-frontend 0x00000001033c54a0 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 15312
7 swift-frontend 0x00000001033e6a04 swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) + 56
8 swift-frontend 0x00000001033ccdd4 llvm::Expected<swift::ExecuteSILPipelineRequest::OutputType> swift::Evaluator::getResultUncached<swift::ExecuteSILPipelineRequest>(swift::ExecuteSILPipelineRequest const&) + 484
9 swift-frontend 0x00000001033cf714 swift::runSILOptimizationPasses(swift::SILModule&) + 400
10 swift-frontend 0x0000000102badc10 swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 524
11 swift-frontend 0x0000000102a1151c performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 1040
12 swift-frontend 0x0000000102a14ab8 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 3288
13 swift-frontend 0x0000000102a12944 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4308
14 swift-frontend 0x00000001029d768c swift::mainEntry(int, char const**) + 4116
15 dyld 0x000000018ab67f28 start + 2236
Xcode 14.2 was working fine.
Expected behavior
Build success
Environment
- Swift compiler version: 5.8
- Xcode version: 14.3
- Deployment target: iOS 14.0
Metadata
Metadata
Assignees
Labels
Area → compiler → SILOptimizer: Dead Code EliminationArea → compiler: SIL optimization passesA deviation from expected or documented behavior. Also: expected but undesirable behavior.The Swift compiler itselfBug: A crash, i.e., an abnormal termination of softwareFlag: An issue whose reproduction requires optimized compilation