Commit Graph

22 Commits

Author SHA1 Message Date
Michael Gottesman
7a2e1fb4d3 [arc-opts] After the arc optimizer converges, run another round of the ARC
optimizer freezing releases in the epilogue of functions that match to
SILArguments. This allows us to treat all such SILArguments throughout the
entire function as having a post dominating release.

<rdar://problem/18923030>

Swift SVN r23253
2014-11-11 23:37:09 +00:00
Michael Gottesman
3d396f8b12 [arc-analysis] Refactor OwnedArgToEpilogueReleaseMatcher from FunctionSigOpts.
Given a function F, this utility class attempts to match up owned arguments with
releases in the epilogue of the function.

I am refactoring this from FunctionSigOpts so I can use it in the ARC optimizer.

<rdar://problem/18923030>

Swift SVN r23219
2014-11-11 00:42:30 +00:00
Michael Gottesman
a014c65205 Expose canInstUseRefCountValues as swift::canNeverUseValues.
canInstUseRefCountValues should have always been named
canInstNotUseRefCountValues. I don't remember how it get renamed as such. Even
though it is a little weird to have a "canNever" in a function name, it makes
sense here to contrast it with canUseValue which returns if a specific user can
use a ptr in a way that requires the ptr to be alive. This in contrast says that
a user can never use a ptr in a manner where the ptr must be alive. I.e. this is
a universal quantifier.

Swift SVN r22961
2014-10-27 09:15:57 +00:00
Jordan Rose
3fcdfd40e9 Remove the "swift/Basic/Optional.h" header.
llvm::Optional lives in "llvm/ADT/Optional.h". Like Clang, we can get
Optional in the 'swift' namespace by including "swift/Basic/LLVM.h".

We're now fully switched over to llvm::Optional!

Swift SVN r22477
2014-10-02 18:51:45 +00:00
Jordan Rose
042569a3be Optional: Replace uses of Nothing with None.
llvm::Optional (like Swift.Optional!) uses None as its placeholder value,
not Nothing.

Swift SVN r22476
2014-10-02 18:51:42 +00:00
Michael Gottesman
f541019660 [codemotion] Extract out isARCInertTrapBB into ARCAnalysis from GARCOpts and teach SILCodeMotion to use it to not move retains into trap bbs.
This reduces the number of retains, releases in the stdlib by another 5% to
15167.

rdar://18328074

Swift SVN r21936
2014-09-13 03:15:29 +00:00
Michael Gottesman
4609513593 Remove SILValue::stripRCIdentityPreservingArgs and teach all uses of that method to use the new RCIdentityAnalysis.
Currently, the pass just calls a local version of that function. After OzU, I
will enable the full pass (which is currently disabled behind a flag).

Swift SVN r21894
2014-09-11 22:29:31 +00:00
Michael Gottesman
5561b3f538 Convert Nothing_t::Nothing => Nothing.
Swift SVN r21605
2014-08-30 03:11:55 +00:00
Michael Gottesman
b617d1b6d1 [arc] Change valueHasARC*InInstructionRange to return either the offending instruction or Nothing_t::None instead of a bool.
This enables us to both check if any instructions may use or decrement a value
in an instruction range and if we find such an instruction know the furthest
where we can move the retain or release.

Swift SVN r21522
2014-08-28 08:00:44 +00:00
Andrew Trick
292d9b3bb2 Fix SILCodeMotion: do not move retains across isUniquelyReferenced.
Sinking retains will simply make the unique check useless and eliminate
Array copies even when we need them.

Fix for:
<rdar://problem/18109082> ARC: make _isUniquelyReferenced a barrier to avoid lost copies

Swift SVN r21485
2014-08-27 18:28:36 +00:00
Michael Gottesman
e998695670 [g-arc-opts] Refactor global arc opts to use the PostOrderAnalysis.
Swift SVN r19915
2014-07-14 01:32:27 +00:00
Michael Gottesman
8685173e21 [arc-analysis] Add two functions for applying canUseValue and canDecrementValue to a contiguous range of instructions in the same BB.
The two functions are:

1. valueHasARCUsesInInstructionRange.
2. valueHasARCDecrementsInInstructionRange.

They operate on the range [Start, End).

I am going to use them in enum simplification and sil code motion.

Swift SVN r19893
2014-07-13 06:32:44 +00:00
Michael Gottesman
fd8f3b197f Add more informative DEBUG messages to valueMayBeCaptured and fix a little bit of formatting in ARCAnalysis.h. NFC.
Swift SVN r18892
2014-06-14 05:42:32 +00:00
Michael Gottesman
a12fb013f7 [g-arc-opts] Create a context object for the matching set computation which stores an evaluator and both state maps. This allows us to not need to recompute the reverse post order over and over again for a single function.
<rdar://problem/17181185>

Swift SVN r18724
2014-06-06 03:45:34 +00:00
Michael Gottesman
c2b2e52260 [g-arc-opts] Implement the merge functions to complete Stage 2 of global arc opts.
Also fixed a small bug related to how we handle arguments. We were not
clearing the state of the argument when we saw a potential decrement of
the argument.

<rdar://problem/17013194>

Swift SVN r18706
2014-06-05 04:35:14 +00:00
Michael Gottesman
445c474ed0 [g-arc-opts] Wired up the Release->RetainState (TDMap), Retain->ReleaseState (BUMap) dataflow into the pair matcher analysis which matches up sets of retains, releases.
This completes the implementation of the bottom up decrement data flow
data analysis.

<rdar://problem/16965332>

Swift SVN r18580
2014-05-23 01:34:13 +00:00
Michael Gottesman
592c2bb265 [g-arc-opts] Move the ARC pairing and dataflow analysis into their own analysis file.
Now the actual GlobalARCOpts pass itself is complete. The rest of the
work is improving the analysis.

rdar://16965332

Swift SVN r18542
2014-05-22 00:58:34 +00:00
Nadav Rotem
e620ed323c Additional negative logic changes. NFC.
Swift SVN r14743
2014-03-06 19:10:32 +00:00
Nadav Rotem
15ec637128 Reverse the negative logic. NFC.
Swift SVN r14742
2014-03-06 19:02:42 +00:00
Michael Gottesman
0044c1d379 [arc-opts] Teach cannotDecrementRefCount how to use alias information to prove
that an apply which may decrement ref counts can not decrement a value with
reference semantics if we can prove the value does not alias any of the applies
arguments.

Swift SVN r14120
2014-02-20 01:08:49 +00:00
Michael Gottesman
8cb9693830 [sil-arc-opts] Teach SILARCOpts how to use alias analysis to determine if a store/load could use a value.
Swift SVN r13658
2014-02-07 22:56:59 +00:00
Michael Gottesman
7461dbd70a Now that we have a PM, separate passes from analyses by creating a separate library swiftSILAnalysis and a separate folder/etc.
Swift SVN r13511
2014-02-05 22:17:50 +00:00