Commit Graph

12848 Commits

Author SHA1 Message Date
Doug Gregor
5b2520e379 Remove IfConfigDecl from the AST
The swift-syntax tree retains information about the parsed #if
regions. Drop it from the semantic AST.
2024-09-18 20:51:54 -07:00
Arnold Schwaighofer
e85d6ae818 IRGen: Split async funclets need to be marked noinline to not loose async_entry/return metadata
rdar://134460666
2024-09-18 16:20:54 -07:00
Konrad `ktoso` Malawski
7d1ce789ad Revert "Revert "Isolated synchronous deinit"" 2024-09-17 17:35:38 +09:00
Ben Barham
a7b50f357f Merge remote-tracking branch 'origin/main' into manual-main-merge
Conflicts:
  - `lib/Driver/ToolChains.cpp` conflicting with the `addAllArgs` rename
    for multiple options
2024-09-16 13:53:18 -07:00
Slava Pestov
c86ce649ff IRGen: Small cleanup 2024-09-16 12:30:50 -04:00
Slava Pestov
a62ab6907d IRGen: Workaround for type substitution limitation
If a constrained extension has fewer conformance requirements
than the nominal type declaration, because some of the type
parameters of the nominal type are fixed to concrete types by
the extension, we would run into trouble because interface
type substitution does not correctly handle this case.

Applying an identity substitution map to an interface type
does not look up concrete types in the output generic
signature, so we get back a type parameter that is not valid.

getReducedType() has a hack to deal with this. I'd like to
get rid of the hack and fix interface type substitution to
do this correctly, but until then, this will do.

Fixes https://github.com/swiftlang/swift/issues/76479
2024-09-16 12:30:49 -04:00
Slava Pestov
f35c90a6b7 Merge pull request #76445 from slavapestov/maptypeintocontext
Overhaul mapTypeIntoContext()
2024-09-14 08:45:20 -04:00
Felipe de Azevedo Piovezan
58bbadd28e [DebugInfo] Dont generate line information at the split point of async funclets
Unless there is some meaningful code on the same line as an await call (e.g.
other parts of an expression), there should be no additional line entries
associated with that line on the continuation funclet.

This patch changes codegen to avoid emitting debug location for the "prologue" code
at the start of a funclet, instead of simply copying the debug location of the
split point.
2024-09-13 19:06:56 -07:00
Allan Shortlidge
02dbb96b94 AST: Rename AvailabilityContext to AvailabilityRange.
The generality of the `AvailabilityContext` name made it seem like it
encapsulates more than it does. Really it just augments `VersionRange` with
additional set algebra operations that are useful for availability
computations. The `AvailabilityContext` name should be reserved for something
pulls together more than just a single version.
2024-09-13 16:25:18 -07:00
Arnold Schwaighofer
8e9cd5db68 Merge pull request #76150 from aschwaighofer/async_entry_ret_metadata
IRGen: Add metadata for async funclets denoting frame entry and frame exists
2024-09-13 11:52:00 -07:00
Arnold Schwaighofer
c9c45a1e53 Revert "Merge pull request #74192 from drexin/wip-typed-throws-abi"
This reverts commit 35b2b71475, reversing
changes made to c3b57f24eb.
2024-09-12 11:42:01 -07:00
Arnold Schwaighofer
7955ba9fc6 Revert "Merge pull request #74839 from drexin/wip-130783369"
This reverts commit 4edda08d26, reversing
changes made to ac5763bb50.
2024-09-12 11:37:01 -07:00
Arnold Schwaighofer
9b10362a09 Revert "Merge pull request #74840 from drexin/wip-130781414"
This reverts commit 7feb5927db, reversing
changes made to 4edda08d26.
2024-09-12 11:35:32 -07:00
Arnold Schwaighofer
25bc3875fa Revert "Merge pull request #75072 from drexin/wip-refactor-te-callemission"
This reverts commit 22b6319c71, reversing
changes made to 4e4d547825.
2024-09-12 11:24:10 -07:00
Arnold Schwaighofer
790c2692d4 Revert "Merge pull request #75149 from drexin/wip-ptr-cast-tt"
This reverts commit 32af2f6c19, reversing
changes made to d84a9190a2.
2024-09-12 11:23:42 -07:00
Arnold Schwaighofer
85c5648d6d Revert "Merge pull request #75150 from drexin/wip-130971168"
This reverts commit 8fca31efde, reversing
changes made to 32af2f6c19.
2024-09-12 11:23:15 -07:00
Arnold Schwaighofer
9bebe11183 Revert "Merge pull request #75221 from drexin/wip-129359370"
This reverts commit c11b301188, reversing
changes made to 1921b60ff4.
2024-09-12 11:22:55 -07:00
Arnold Schwaighofer
8be107735e Revert "Merge pull request #75316 from drexin/wip-131960281"
This reverts commit e3577ed266, reversing
changes made to f3acbb079f.
2024-09-12 11:22:14 -07:00
Arnold Schwaighofer
2bc788c102 Revert "Merge pull request #75379 from drexin/wip-132122011"
This reverts commit 618a9bf7c5, reversing
changes made to 448596c03e.
2024-09-12 11:20:14 -07:00
Arnold Schwaighofer
291abb6255 Revert "Merge pull request #75677 from drexin/wip-133006541"
This reverts commit 739c7192ae, reversing
changes made to 7d1c505ae1.
2024-09-12 11:17:55 -07:00
Arnold Schwaighofer
66586a69ad Revert "Merge pull request #76129 from aschwaighofer/irgen_typed_throws_irgenthunk"
This reverts commit dd0de58b52, reversing
changes made to 74b3221042.
2024-09-12 10:33:33 -07:00
Arnold Schwaighofer
55252e5f0b Revert "Merge pull request #76302 from drexin/wip-typed-throws-empty"
This reverts commit cf2af6809e, reversing
changes made to 0c30f5532e.
2024-09-12 10:33:20 -07:00
Arnold Schwaighofer
617a089115 Revert "Merge pull request #76396 from aschwaighofer/async_typed_throws_empty_errors"
This reverts commit ba8b7e44b8, reversing
changes made to 4693a4765f.
2024-09-12 10:31:26 -07:00
Slava Pestov
354a194ad1 IRGen: Use mapConformanceRefIntoContext() in OpaqueTypeDescriptorBuilder 2024-09-12 11:49:59 -04:00
Alejandro Alonso
3b741ee488 Merge pull request #76303 from Azoy/rawlayout-fixes
[IRGen] Collect metadata from like type and add type information when GEPing into raw layouts
2024-09-11 16:25:24 -07:00
Arnold Schwaighofer
ba8b7e44b8 Merge pull request #76396 from aschwaighofer/async_typed_throws_empty_errors
IRGen: Async throwing functions with empty error types pass the error indirectly
2024-09-11 16:02:50 -07:00
Alejandro Alonso
389716a9bb Only collect count information if it's a value parameter 2024-09-11 09:11:15 -07:00
Arnold Schwaighofer
ede9f33c52 Fix the fix 2024-09-11 08:20:48 -07:00
Arnold Schwaighofer
fe15d04505 IRGen: Async throwing functions with empty error types pass the error indirectly
rdar://135304464
2024-09-10 17:33:10 -07:00
Doug Gregor
cd52e2d4e5 Fix ABI mismatch involving Sendable-refining protocols and deployment targets
A change to the way we determined whether a protocol conformance is
"dependent" for marker protocols caused an ABI break for
Sendable-refining protocols built with pre-6.0 Swift compilers. The
fix for this issue (https://github.com/swiftlang/swift/pull/75769)
gated the change on deployment target.

The deployment target change fixed the original problem, then caused a
related issue when a project mixes deployment targets (pre-6.0 and
6.0+) with non-resilient protocols. Exempt non-resilient protocols from
this change so we get consistent behavior.

Fixes rdar://134953989.
2024-09-10 11:40:50 -07:00
Meghana Gupta
a7518ac3d9 Merge pull request #76255 from meg-gupta/disablemangling
Delete lifetime dependence mangling
2024-09-09 19:59:16 -07:00
swift-ci
3cd6e6d181 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-06 11:54:55 -07:00
Dario Rexin
cf2af6809e Merge pull request #76302 from drexin/wip-typed-throws-empty
[IRGen] Fix SignatureExpansion::expandAsyncAwaitType
2024-09-06 11:44:44 -07:00
Dario Rexin
a4c1d2ec0c [IRGen] Fix SignatureExpansion::expandAsyncAwaitType
For typed throws async functions, when the error type is `Never` and the result type `Void`, we still have to add the error context
2024-09-06 07:33:18 -07:00
swift-ci
83ee206cd3 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-05 23:34:13 -07:00
Arnold Schwaighofer
dbf2f6229c Merge pull request #76282 from aschwaighofer/loadable_by_address_reg2mem_throw
[loadable by address reg2mem] Implement missing throw instruction
2024-09-05 23:33:40 -07:00
Meghana Gupta
10057523ec Delete lifetime dependence mangling
Mangling this information for future directions like component lifetimes
becomes complex and the current mangling scheme isn't scalable anyway.

Deleting this support for now.
2024-09-05 22:03:58 -07:00
Alejandro Alonso
7219daf418 Collect metadata from like type and add type information when GEPing into raw layouts 2024-09-05 18:04:47 -07:00
swift-ci
da55e84c74 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-05 15:35:33 -07:00
Alejandro Alonso
45d7ea39a5 Merge pull request #75518 from Azoy/integer-generics
Implement Value generics
2024-09-05 15:33:46 -07:00
swift-ci
93b400de6d Merge remote-tracking branch 'origin/main' into rebranch 2024-09-05 14:14:34 -07:00
Hiroshi Yamauchi
273f5fdc36 Merge pull request #76159 from hjyamauchi/issue74866
Add the inreg attribute to sreg when present.
2024-09-05 13:59:53 -07:00
Arnold Schwaighofer
eeaf9621f2 [loadable by address reg2mem] Implement missing throw instruction
rdar://134914984
2024-09-05 08:12:32 -07:00
Hiroshi Yamauchi
3f0de5787e Add the inreg attribute to sreg when present.
On Windows/AArch64, a different register is used between when an
arugment is both inreg and sret (X0 or X1) and when it is just sret
(X8) as the following comment indicates:

46fe36a429/llvm/lib/Target/AArch64/AArch64CallingConvention.td (L42)

```
  // In AAPCS, an SRet is passed in X8, not X0 like a normal pointer parameter.
  // However, on windows, in some circumstances, the SRet is passed in X0 or X1
  // instead.  The presence of the inreg attribute indicates that SRet is
  // passed in the alternative register (X0 or X1), not X8:
  // - X0 for non-instance methods.
  // - X1 for instance methods.

  // The "sret" attribute identifies indirect returns.
  // The "inreg" attribute identifies non-aggregate types.
  // The position of the "sret" attribute identifies instance/non-instance
  // methods.
  // "sret" on argument 0 means non-instance methods.
  // "sret" on argument 1 means instance methods.

  CCIfInReg<CCIfType<[i64],
        CCIfSRet<CCIfType<[i64], CCAssignToReg<[X0, X1]>>>>>,

  CCIfSRet<CCIfType<[i64], CCAssignToReg<[X8]>>>,
```

So missing/dropping inreg can cause a codegen bug.

This is a partial fix for #74866
2024-09-04 18:00:36 -07:00
Alejandro Alonso
f2f82a7de6 Add initRawStructMetadata2 for safety 2024-09-04 15:13:51 -07:00
Alejandro Alonso
9906db37c7 Fix closures capturing value generics 2024-09-04 15:13:50 -07:00
Alejandro Alonso
4a7fb6f5fe Some test fixes 2024-09-04 15:13:48 -07:00
Alejandro Alonso
4f07c060b7 Future proof the initRawStructMetadata entrypoint 2024-09-04 15:13:46 -07:00
Alejandro Alonso
f4f60f4344 Remove Value requirement Add GenericTypeParamKind 2024-09-04 15:13:43 -07:00
Alejandro Alonso
b663a151fe Add tests for raw layout vector 2024-09-04 15:13:28 -07:00