Commit Graph

10 Commits

Author SHA1 Message Date
Kavon Farvardin
37cc8cb174 add optimizations-on variants directly in noncopyable tests 2023-05-22 17:17:52 -07:00
Michael Gottesman
739417ff09 [move-only] Convert __shared to borrowing in move only tests.
These are the same semantically, just the mangling is slightly different. The
benefit of doing this is that we are actually testing what we expect our users
to do.

rdar://108511703
2023-04-25 10:51:04 -07:00
Kavon Farvardin
2c7d9a5047 update tests given move-only types are enabled
the main things still left behind the experimental flag(s) are
- move-only classes (guarded by MoveOnlyClasses feature)
- noimplicitcopy
- the _borrow operator
2023-03-14 18:35:13 -07:00
Joe Groff
ecceb02e2a Implement consume x operator with the accepted SE-0366 syntax.
Implement it as a contextual operator that only parses as an operator when
followed by an identifier.
2023-03-01 17:37:54 -08:00
Kavon Farvardin
c948f3c04f add ownership to tests using noncopyable parameters 2023-02-16 22:08:13 -08:00
Erik Eckstein
d25b1ed834 Optimizer: Replace the MandatoryCombine pass with a Simplification pass, which is implemented in Swift
The Swift Simplification pass can do more than the old MandatoryCombine pass: simplification of more instruction types and dead code elimination.
The result is a better -Onone performance while still keeping debug info consistent.

Currently following code patterns are simplified:
* `struct` -> `struct_extract`
* `enum` -> `unchecked_enum_data`
* `partial_apply` -> `apply`
* `br` to a 1:1 related block
* `cond_br` with a constant condition
* `isConcrete` and `is_same_metadata` builtins

More simplifications can be added in the future.

rdar://96708429
rdar://104562580
2023-02-09 06:50:05 +01:00
Michael Gottesman
51e90ee52c [move-only] Ban creating protocol conformances on move only nominal types.
I added code to the type checker that both bans this when one adds the
conformance on the nominal type declaration as well as on extensions. I was
careful to ensure we can still add extensions without an inherited clause.

Doing this until we get the full generics model.

rdar://101874019
2022-11-04 12:48:44 -07:00
Michael Gottesman
285f03ee8c [move-only] Change type lowering to ensure that we use {retain,release}_value instead of strong_{retain,release} for move only enum/structs
This ensures that when we hit IRGen, if we have a type with trivial contents, we
emit nothing and if we have a type with non-trivial contents, we just emit
recursive retain/release as appropriate.

This is the last bug holding up the buffer view prototype from Guilliume.
2022-10-24 21:16:46 -07:00
Michael Gottesman
b1d6768920 [move-only] Turn off the buffer view test for now when optimizations are enabled.
The proof of concept is only intended to be used without optimizations right
now.
2022-09-21 16:19:43 -07:00
Michael Gottesman
b1738c63c7 [move-only] Implement MoveOnlyDeinitInsertion that converts destroy_value of known deinit move only types to call the deinit directly.
NOTE: If one does not define a deinit on a move only type, if a destroy_value
lasts until IRGen time we will assert since I haven't implemented support in
IRGen for the destroy value witness for move only types. That being said, just
creating a deinit by adding to such a type:

```
deinit {}
```

is pretty low overhead for the experiments we want to use this for.
2022-09-20 15:19:31 -07:00