Commit Graph

7 Commits

Author SHA1 Message Date
Nate Chandler
d55c169d80 [CopyPropagation] Destroy hoist -> canonicalize.
Replace usages of lexical destroy hoisting with owned value
canonicalization now that the latter supports lexical values.
2024-07-22 20:35:30 -07:00
Nate Chandler
10ce0c6b16 [SILGen] Used move_value for lexical lets.
Instead of using begin_borrow [lexical] + copy_value.
2023-12-14 13:35:26 -08:00
Nate Chandler
6bb18263d1 [Test] Adjusted SIL tests.
Now that
- owned arguments don't get lexical borrow scopes from SILGen
- owned arguments get lexical moves during inlining unless the value
  passed for that argument is already lexical
- guaranteed arguments don't get lexical borrow scopes during inlining
  when the value passed for that argument is already lexical
tests involving owned argument emission from SILGen and inlining need to
be updated.
2023-01-25 11:36:33 -08:00
Nate Chandler
62dc05fc51 [CopyPropagation] Hoist owned lexical destroys. 2022-02-16 10:31:24 -08:00
Nate Chandler
257e1d3f29 [Test] Reenabled SILOpt/shrink_borrow_scope.
LexicalDestroyFolding allows us to elide the spurious retain/release
that was being tested here.

rdar://87255563
2022-02-04 14:41:40 -08:00
Nate Chandler
3ba8a93c48 [ShrinkBorrowScope] Don't hoist over any applies.
Previously, hoisting was done over applies that were users of the
borrowed value.  Here, that is no longer done.

That hoisting was done on the theory that multiple distinct lexical
scopes were equivalent to a single enclosing lexical scope.  Dead borrow
elimination, however, means that they are not in fact the same, however:
If a callee takes an object as an argument, and in that callee that
argument is dead, FSO and inliniing (even with approaches to maintain
lexical borrow scopes when the value that is borrowed comes from an
owned argument) can result in a dead borrow scope in the caller which
could then be eliminated which would then enable the destroy_value
to be hoisted over the inlined body, including over barriers.
2022-01-07 09:36:40 -08:00
Nate Chandler
282150bf0c [Test] Added swift test for ShrinkBorrowScope.
The new file tests the -O pipeline up to just before OSSA lowering.  It
will be used for verifying the effects of ShrinkBorrowScope on swift
code directly, to complement the tests done on SIL by just running a
single pass.
2021-12-19 08:14:46 -08:00