Commit Graph

6 Commits

Author SHA1 Message Date
Joe Groff
3d779cd789 IRGen: Fix DenseMap interior pointer invalidation bug in IRGenSILFunction::visitEndApply.
Fixes rdar://144216380.
2025-02-05 15:50:09 -08:00
Arnold Schwaighofer
4a2d8dc6a5 Disable test that will block releasing toolchains AutoDiff/validation-test/modify_accessor.swift
Until folks look at whats wrong.

This triggered a use-after-free in IRGen while visiting end_apply on the ASAN bot.

https://ci.swift.org/job/oss-swift-incremental-ASAN-RA-macos/7721/

Likely triggered by the changes in https://github.com/swiftlang/swift/pull/79127 (based on blame list)

rdar://144216380
2025-02-05 07:18:45 -08:00
Dario Rexin
86377b32b1 Merge pull request #76743 from swiftlang/coro-pa-context
Fix partial apply forwarder emission for coroutines that are methods of structs with type parameters
2024-11-21 03:05:25 -08:00
Arnold Schwaighofer
abb065a702 Disable AutoDiff/validation-test/modify_accessor.swift on arm64e
We fail to sign a pointer and so this test currently fails on arm64e.

rdar://136835713
2024-10-01 08:03:49 -07:00
Anton Korobeynikov
6eefd963c6 Fix partial apply forwarder emission for coroutines that are methods
of structs with type parameters. Simplify the code while here
2024-09-26 21:52:17 -07:00
Andrew Savonichev
5aa9d3e29b Add partial_apply support for coroutines (#71653)
The patch adds lowering of partial_apply instructions for coroutines.

This pattern seems to trigger a lot of type mismatch errors in IRGen, because
coroutine functions are not substituted in the same way as regular functions
(see the patch 07f03bd2 "Use pattern substitutions to consistently abstract
yields" for more details). 

Other than that, lowering of partial_apply for coroutines is straightforward: we
generate another coroutine that captures arguments passed to the partial_apply
instructions. It calls the original coroutine for yields (first return) and
yields the resulting values. Then it calls the original function's continuation
for return or unwind, and forwards them to the caller as well.

After IRGen, LLVM's Coroutine pass transforms the generated coroutine (along with
all other coroutines) and eliminates llvm.coro.* intrinsics. LIT tests check
LLVM IR after this transformation.

Co-authored-by: Anton Korobeynikov <anton@korobeynikov.info>
Co-authored-by: Arnold Schwaighofer <aschwaighofer@apple.com>
2024-08-08 18:36:42 -07:00