Commit Graph

13 Commits

Author SHA1 Message Date
Erik Eckstein
1ab14be60d tests: add a missing codesign in devirtualize_existential.swift
rdar://130528110
2024-06-26 10:19:56 +02:00
Erik Eckstein
864c1434e8 Devirtualizer: fix a crash due to a not supported bitcast of ABI compatible types
When devirtualizing witness method calls, it can happen that we need a cast between ABI compatible return types.
We were missing supporting type casts between nominal types which are ABI compatible.

This comes from whole-module reasoning of protocol conformances.
If a protocol only has a single conformance where the associated type (`ID`) is some concrete type (e.g. `Int`), then the devirtualizer knows that `p.get()` can only return an `Int`:
```
public struct X2<ID> {
  let p: any P2<ID>
  public func testit(i: ID, x: ID) -> S2<ID> {
    return p.get(x: x)
  }
}
```
and after devirtualizing the `get` function, its result must be cast from `Int` to `ID`.

The `layoutIsTypeDependent` utility is basically only used here to assert that this cast can only happen between layout compatible types.

rdar://129004015
2024-06-21 17:28:33 +02:00
Erik Eckstein
39bb14b094 change mangling prefix from $S to $s
This is the final ABI mangling prefix

rdar://problem/38471478
2018-09-19 13:55:11 -07:00
Erik Eckstein
cd3d50a5d9 ABI: Change the mangling prefix from _T0 to $S 2018-01-06 13:55:59 -08:00
Erik Eckstein
c4a11f4c92 tests: remove the now unused option -new-mangling-for-tests 2017-03-22 11:28:43 -07:00
Slava Pestov
eb45355a89 Revert "SILCombiner: Clean up the concrete -> existential peephole a bit" 2017-03-06 13:14:46 -08:00
Slava Pestov
44f2397c36 SILCombiner: Clean up the concrete -> existential peephole a bit
Use Substitution::subst() to replace the opened existential with
the concrete type. I don't have a test case, but I think the old
code would have failed if a non-Self substitution also contained
the opened existential, which could happen after generic inlining.

Also, it looks like the guard against devirtualizing methods returning
Self is no longer necessary, because the devirtualizer can insert the
necessary casts. In any case, the check was incorrect because we now
allow calling methods on existentials that return Self as part of
another type in covariant position, such as Optional<Self> or
`() -> Self`.
2017-03-04 23:58:50 -08:00
Erik Eckstein
1d3724666f tests: convert about 400 tests to the new mangling by using the -new-mangling-for-tests option
When the new mangling is enabled permanently, the option can be removed from the RUN command lines again.
2017-01-24 15:27:45 -08:00
Roman Levenstein
c6bb2e2a7e Enable a previously disabled test.
The FIXME is resolved now and the test can be enabled.

rdar://27781174
2016-08-12 10:44:38 -07:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Dmitri Gribenko
dcadab0abf Fix tests to work with the new 'FileCheck' substitution 2016-08-10 23:50:57 -07:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
Andrew Trick
bd35b4789c Move test/SILOptimizer files to reflect lib/SILOptimizer. 2015-12-11 15:53:22 -08:00