Commit Graph

13 Commits

Author SHA1 Message Date
Slava Pestov
9ec80df97e SIL: Remove curried SILDeclRefs 2020-03-19 02:20:21 -04:00
Michael Gottesman
cf0405c7f1 [clf] Simplify the double diamond lifetime extension for escaping swift funcs -> noescape blocks.
Specifically, when we optimize conversions such as:

  Optional<@escaping () -> ()>

  ->

  Optional<@noescape () -> ()>

  ->

  Optional<@noescape @convention(block) () -> ()>

previously we were lifetime extending over the @noescape lifetime barrier by
making a copy and then putting a mark_dependence from the copy onto the original
value. This was just a quick way to tell the ownership verifier that the copy
was tied to the other value and thus should not be eliminated. The correctness
of the actual lifetime extension comes from the optimizer being conservative
around rr insts.

This commit instead changes our optimization to borrow the copied optional
value, extract the payload, and use that instead.
2019-06-09 22:04:32 -07:00
Michael Gottesman
e11794bbfa [closure-lifetime-fixup] Make sure that all copy_value we insert have a data dependence on the cvt_escape_to_no_escape.
Otherwise, the ownership model doesn't understand the need for the copies and
just removes them.
2019-03-26 16:56:29 -07:00
Michael Gottesman
3ebd8df493 [gardening] Remove unnecessary -enable-sil-ownership from tests that now just get it from their pattern.
This just eliminates -enable-sil-ownership from all target-swift-frontend and
target-swift-emit-silgen RUN lines. Both of those now include
enable-sil-ownership in their expansion.
2019-03-12 20:39:18 -07:00
Michael Gottesman
36fc50370f [closure-lifetime-fixup] Use the SSAUpdater rather than memory to extend the lifetime to the end of the function.
This beyond being slightly cleaner ensures that we do not try to promote in
PredictableMemOpts any loads from the alloc_stack. Doing this would force us to
insert a copy in ossa which then would break is_escaping_closure even when we
don't escape.

rdar://problem/46188001
2019-02-25 19:13:56 -08:00
Andrew Trick
ba03bef27e Fix test cases for SILGen after removing critical edges. 2018-10-19 23:14:17 -07: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
Arnold Schwaighofer
b2c42343fa Fix test cases after SIL representation changes
rdar://39682865
2018-05-01 07:24:19 -07:00
Arnold Schwaighofer
02a91ef873 Fix test cases 2018-04-13 13:56:30 -07:00
Arnold Schwaighofer
e490726d70 Fix logic error in fixupConvertEscapeToNoEscapeLifetime 2018-03-30 12:42:06 -07:00
Arnold Schwaighofer
f40ac5d6d9 Rewrite DI to always guaranteed the lifetime of the convert_escape_to_noescape [not_guaranteed] operand
Either through a peephole or we keep the closure operand alive to the end of the function

rdar://38124009
2018-03-30 09:27:53 -07:00
Arnold Schwaighofer
4bc4a639ad Disable definite-init-convert-to-escape.swift test case on linux 2018-03-30 06:20:13 -07:00
Arnold Schwaighofer
a9786978b2 Ensure lifetimes of optional convert_escape_to_noescape closures
rdar://38124009
2018-03-30 06:20:13 -07:00