[llvm] [Coroutines] Work on intrinsic IDs instead of names (NFCI) (PR #145518)
Anthony Latsis via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 24 04:03:45 PDT 2025
================
@@ -61,71 +61,56 @@ CallInst *coro::LowererBase::makeSubFnCall(Value *Arg, int Index,
return CallInst::Create(Fn, {Arg, IndexVal}, "", InsertPt->getIterator());
}
-// NOTE: Must be sorted!
-static const char *const CoroIntrinsics[] = {
- "llvm.coro.align",
- "llvm.coro.alloc",
- "llvm.coro.async.context.alloc",
- "llvm.coro.async.context.dealloc",
- "llvm.coro.async.resume",
- "llvm.coro.async.size.replace",
- "llvm.coro.await.suspend.bool",
- "llvm.coro.await.suspend.handle",
- "llvm.coro.await.suspend.void",
- "llvm.coro.begin",
- "llvm.coro.begin.custom.abi",
- "llvm.coro.destroy",
- "llvm.coro.done",
- "llvm.coro.end",
- "llvm.coro.end.async",
- "llvm.coro.frame",
- "llvm.coro.free",
- "llvm.coro.id",
- "llvm.coro.id.async",
- "llvm.coro.id.retcon",
- "llvm.coro.id.retcon.once",
- "llvm.coro.noop",
- "llvm.coro.prepare.async",
- "llvm.coro.prepare.retcon",
----------------
AnthonyLatsis wrote:
@nikic Were these two intrinsics removed from the list deliberately? As far as we can see, they are not overloaded. We have traced the following Swift crash back to this change:
```
05:07:22 <unknown>:0: error: fatal error encountered during compilation; please submit a bug report (https://swift.org/contributing/#reporting-bugs)
05:07:22 <unknown>:0: note: Cannot select: intrinsic <<INTERNAL ERROR: unparseable argument index in diagnostic text>>.coro.prepare.retcon
05:07:22 Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
05:07:22 Stack dump:
05:07:22 0. Program arguments: /Users/ec2-user/jenkins/workspace/oss-swift-rebranch-incremental-RA-macos/build/buildbot_incremental/swift-macosx-x86_64/bin/swift-frontend -frontend -c /Users/ec2-user/jenkins/workspace/oss-swift-rebranch-incremental-RA-macos/swift/benchmark/single-source/AngryPhonebook.swift -target x86_64-apple-macosx13.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk -I /Users/ec2-user/jenkins/workspace/oss-swift-rebranch-incremental-RA-macos/swift/benchmark/utils/ObjectiveCTests -I /Users/ec2-user/jenkins/workspace/oss-swift-rebranch-incremental-RA-macos/swift/benchmark/utils/LibProc -I /Users/ec2-user/jenkins/workspace/oss-swift-rebranch-incremental-RA-macos/build/buildbot_incremental/swift-macosx-x86_64/benchmark/Onone-x86_64-apple-macosx13.0 -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -no-color-diagnostics -Xcc -fno-color-diagnostics -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /Users/ec2-user/jenkins/workspace/oss-swift-rebranch-incremental-RA-macos/build/buildbot_incremental/swift-macosx-x86_64/benchmark/modulecache -swift-version 4 -Onone -empty-abi-descriptor -enable-anonymous-context-mangled-names -file-compilation-dir /Users/ec2-user/jenkins/workspace/oss-swift-rebranch-incremental-RA-macos/build/buildbot_incremental/swift-macosx-x86_64/benchmark -Xllvm -align-module-to-page-size -no-auto-bridging-header-chaining -module-name AngryPhonebook -in-process-plugin-server-path /Users/ec2-user/jenkins/workspace/oss-swift-rebranch-incremental-RA-macos/build/buildbot_incremental/swift-macosx-x86_64/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Users/ec2-user/jenkins/workspace/oss-swift-rebranch-incremental-RA-macos/build/buildbot_incremental/swift-macosx-x86_64/lib/swift/host/plugins -plugin-path /Users/ec2-user/jenkins/workspace/oss-swift-rebranch-incremental-RA-macos/build/buildbot_incremental/swift-macosx-x86_64/local/lib/swift/host/plugins -target-sdk-version 15.2 -target-sdk-name macosx15.2 -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -parse-as-library -o /Users/ec2-user/jenkins/workspace/oss-swift-rebranch-incremental-RA-macos/build/buildbot_incremental/swift-macosx-x86_64/benchmark/Onone-x86_64-apple-macosx13.0/AngryPhonebook.o
05:07:22 1. Apple Swift version 6.2-dev (LLVM f5046f23b26618e, Swift 92b11744a2d7cbf)
05:07:22 2. Compiling with effective version 4.1.50
05:07:22 3. Running pass 'Function Pass Manager' on module '/Users/ec2-user/jenkins/workspace/oss-swift-rebranch-incremental-RA-macos/build/buildbot_incremental/swift-macosx-x86_64/benchmark/Onone-x86_64-apple-macosx13.0/AngryPhonebook.o'.
05:07:22 4. Running pass 'X86 DAG->DAG Instruction Selection' on function '@"$sSlsE3mapySayqd__Gqd__7ElementQzqd_0_YKXEqd_0_YKs5ErrorRd_0_r0_lF"'
05:07:22 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):
05:07:22 0 swift-frontend 0x000000010886a4e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 40
05:07:22 1 swift-frontend 0x000000010886818b llvm::sys::RunSignalHandlers() + 283
05:07:22 2 swift-frontend 0x000000010886b046 SignalHandler(int, __siginfo*, void*) + 278
05:07:22 3 libsystem_platform.dylib 0x00007ff804afce9d _sigtramp + 29
05:07:22 4 libswiftCore.dylib 0x00007ff81628c6ec $ss11_StringGutsV23prepareForAppendInPlace33_408A76AB043BD3EFBAB6FAAAAA9B4914LL10totalCount09otherUTF8O0ySi_SitF + 492
05:07:22 5 libsystem_c.dylib 0x00007ff8049e8b19 abort + 126
05:07:22 6 swift-frontend 0x0000000101a5b791 swift::DiagnosticHelper::Implementation::diagnoseFatalError(char const*, bool) + 657
05:07:22 7 swift-frontend 0x00000001087d2608 llvm::report_fatal_error(llvm::Twine const&, bool) + 360
05:07:22 8 swift-frontend 0x00000001056e2d21 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) + 753
05:07:22 9 swift-frontend 0x00000001056e156b llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) + 19435
05:07:22 10 swift-frontend 0x000000010370e0b1 (anonymous namespace)::X86DAGToDAGISel::Select(llvm::SDNode*) + 29697
05:07:22 11 swift-frontend 0x00000001056d6f60 llvm::SelectionDAGISel::DoInstructionSelection() + 1488
05:07:22 12 swift-frontend 0x00000001056d5f40 llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 5904
05:07:22 13 swift-frontend 0x00000001056d3fef llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 6991
05:07:22 14 swift-frontend 0x00000001056d143a llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 634
05:07:22 15 swift-frontend 0x00000001056cf549 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) + 169
05:07:22 16 swift-frontend 0x00000001059718a0 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 1088
05:07:22 17 swift-frontend 0x0000000108698120 llvm::FPPassManager::runOnFunction(llvm::Function&) + 672
05:07:22 18 swift-frontend 0x000000010869fd74 llvm::FPPassManager::runOnModule(llvm::Module&) + 68
05:07:22 19 swift-frontend 0x0000000108698adf llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1903
05:07:22 20 swift-frontend 0x0000000101da8234 swift::compileAndWriteLLVM(llvm::Module*, llvm::TargetMachine*, swift::IRGenOptions const&, swift::UnifiedStatsReporter*, swift::DiagnosticEngine&, llvm::raw_pwrite_stream&, llvm::sys::SmartMutex<false>*, llvm::raw_pwrite_stream*) + 308
05:07:22 21 swift-frontend 0x0000000101da7650 swift::performLLVM(swift::IRGenOptions const&, swift::DiagnosticEngine&, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, llvm::StringRef, llvm::vfs::OutputBackend&, swift::UnifiedStatsReporter*) + 2224
05:07:22 22 swift-frontend 0x00000001017b1b12 generateCode(swift::CompilerInstance&, llvm::StringRef, llvm::Module*, llvm::GlobalVariable*) + 466
05:07:22 23 swift-frontend 0x00000001017aafba 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*) + 1530
05:07:22 24 swift-frontend 0x00000001017aa518 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 2008
05:07:22 25 swift-frontend 0x00000001017bc76f withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 143
05:07:22 26 swift-frontend 0x00000001017aeb05 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 933
05:07:22 27 swift-frontend 0x00000001017abb2e swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2798
05:07:22 28 swift-frontend 0x00000001014fa02b swift::mainEntry(int, char const**) + 3435
05:07:22 29 dyld 0x00007ff80473a2cd start + 1805
```
We discovered that the `CoroSplitPass` pass, which removes calls to `llvm.coro.prepare.retcon`, is no longer run under these conditions, leading to what seems like an expectation breakage during instruction selection.
https://github.com/llvm/llvm-project/pull/145518
More information about the llvm-commits
mailing list