Commit Graph

14 Commits

Author SHA1 Message Date
Anthony Latsis
55e5618eab [test] Match nocapture to succeed both on main and rebranch
Both the syntax and relative order of the LLVM `nocapture` parameter
attribute changed upstream in 29441e4f5fa5f5c7709f7cf180815ba97f611297.
To reduce conflicts with rebranch, adjust FileCheck patterns to expect
both syntaxes and orders anywhere the presence of the attribute is not
critical to the test. These changes are temporary and will be cleaned
up once rebranch is merged into main.
2025-05-08 23:52:43 +01:00
Arnold Schwaighofer
056e18ca66 Add and fix test case 2025-02-07 10:49:07 -08:00
Erik Eckstein
1dab2942df Optimizer: enable the DeinitDevirtualizer pass
It was disabled so far to not hide bugs in the deinit code generation. Now hopefully deinit code generation is stable enough to enable the pass.
2024-08-12 13:34:51 +02:00
Kavon Farvardin
0420310623 NCGenerics: it's no longer "experimental"
resolves rdar://127701059
2024-05-08 10:49:12 -07:00
Doug Gregor
757ebe2979 Future-proof the mangling of invertible protocols
Invertible protocols are currently always mangled with `Ri`, followed by
a single letter for each invertible protocol (e.g., `c` and `e` for
`Copyable` and `Escapable`, respectively), followed by the generic
parameter index. However, this requires that we extend the mangling
for any future invertible protocols, which mean they won't be
backward compatible.

Replace this mangling with one that mangles the bit # for the
invertible protocol, e.g., `Ri_` (followed by the generic parameter
index) is bit 0, which is `Copyable`. `Ri0_` (then generic parameter
index) is bit 1, which is `Escapable`. This allows us to round-trip
through mangled names for any invertible protocol, without any
knowledge of what the invertible protocol is, providing forward
compatibility. The same forward compatibility is present in all
metadata and the runtime, allowing us to add more invertible
protocols in the future without updating any of them, and also
allowing backward compatibility.

Only the demangling to human-readable strings maps the bit numbers
back to their names, and there's a fallback printing with just the bit
number when appropriate.

Also generalize the mangling a bit to allow for mangling of invertible
requirements on associated types, e.g., `S.Sequence: ~Copyable`. This
is currently unsupported by the compiler or runtime, but that may
change, and it was easy enough to finish off the mangling work for it.
2024-03-28 21:26:13 -07:00
Nate Chandler
e507a6bcea [IRGen] Defer materializing metadata for outlining
Rather than materializing the metadata on demand during visitation, only
collect the types that may be required.  Finally, materialize everything
that's needed at the end.
2024-03-15 14:12:28 -07:00
Nate Chandler
34dd4aa0cb [IRGen] Collect metadata for empty types fields.
Previously, when the metadata collector only collected for layout, it
was wasteful to visit the empty fields of records.  Now that the field
may require a deinit call, it's necessary to visit it.

rdar://123577998
2024-03-08 22:19:28 -08:00
Nate Chandler
ce7e94833d [Test] Removed spurious check lines. 2024-03-02 21:05:52 -08:00
Nate Chandler
f638918be8 [IRGen] Multi payload enum consumes call deinits.
They include the necessary metadata.
2024-03-01 21:01:50 -08:00
Nate Chandler
0075682b4d [IRGen] Single payload enums consumes call deinits
The include the necessary metadata.
2024-03-01 21:01:50 -08:00
Nate Chandler
9a8c814553 [Outlining] Pass polymorphic args of type.
If any deinit must be called, just pass the full generic environment of
the type being destroyed.
2024-03-01 21:01:50 -08:00
Yuta Saito
8a2936b006 test: Fix IRGen/moveonly_value_functions.swift for 32-bit targets 2024-02-23 14:42:08 +00:00
Nate Chandler
36b473d365 [IRGen] Pass deinit metadata to outlined release.
Given a releasable value which contains a noncopyable value type with a
deinit, that values outlined release function, among other things, must
call the deinit of that noncopyable value type.  In order to do that,
its type metadata must be passed to the value function if it has an
archetype.
2024-02-21 19:31:52 -08:00
Nate Chandler
f3b9dec880 [IRGen] Collect nc deinit metadata for outlining.
Some outlined functions call deinits for noncopyable values.  These
deinits require the metadata for the full type.

Teach the OutliningMetadataCollector to collect the metadata for these
types, when the new needsDeinit flag is set.

Also add the new needsLayout flag.  For now, all outlined functions need
it.
2024-02-21 19:31:52 -08:00