Commit Graph

5 Commits

Author SHA1 Message Date
Michael Gottesman
4aa4ac3027 [moveOnly] Add checker that validates that if a let/param copyable value has _move applied to it, the let doesn't have any later uses.
This is just an initial prototype for people to play with. It is as always
behind the -enable-experimental-move-only flag.

NOTE: In this PR I implemented this only for 'local let' like things (local
lets/params). I did not implement in this PR support for local var and haven't
done anything with class ivars or globals.

rdar://83957028
2021-11-04 17:13:29 -07:00
Andrew Trick
ab0601d97a Add PrunedLiveness::computeSSALiveness
Straighforward API to build pruned liveness from a single SSA value.

This 3-line function allows PrunedLiveness to be used anywhere
ValueLifetimeAnalysis was used in OSSA form. Aside from simplicity and
efficiency, the difference is that this composes with other utilities
that only care about PrunedLiveBlocks, PrunedLiveness, or
PrunesLivenessBounary independent of how those data structures were generated.
2021-10-06 09:23:17 -07:00
Andrew Trick
c056ca6f7a Add PrunedLivenessBoundary mini-abstraction
Simple wrapper to compute the boundary of PrunedLiveness.

Pervasively useful utility for working with OSSA reference lifetimes
and borrow scopes.

This can also replace the implementation in
CanonicalOSSALifetime. This will greatly simplify that utility's
logic, preparing it to handle diagnostics (like move-only SILValue
checking) and other features.
2021-10-06 09:23:17 -07:00
Andrew Trick
ec64297893 Add PrunedLiveness::isWithinBoundary API
A perfectly straightforward liveness check. Used by OSSA utilities to
check that an instruction is within a lifetime or scope.
2021-10-06 09:23:02 -07:00
Andrew Trick
add3406cfe Move PrunedLiveness so it can be used as a lightweight OSSA helper.
For use in OwnershipUtils.
2021-10-06 09:23:02 -07:00