Commit Graph

29 Commits

Author SHA1 Message Date
Michael Gottesman
0edf7ef177 Fix indentation of various DEBUG(...) messages.
Swift SVN r26762
2015-03-31 16:44:38 +00:00
Michael Gottesman
4ec67e9278 [arc] Teach ARC analysis how to determine uses of terminators rather than just bailing.
We were always treating terminators (even without arguments) as uses. This is
incorrect. With this patch we now say that a terminator can not use a ref count
pointer if all of the terminator's arguments conservatively can not alias the
pointer.

rdar://20335297

Swift SVN r26664
2015-03-28 01:38:29 +00:00
Nadav Rotem
f0fa502d56 Split the RCIdentityAnalysis analysis to allow per-function invalidation.
Before the change the RCIdentityAnalysis kept a single map that contained
the module's RC information. When function passes needed to invalidate the
analysis they had to clear the RC information for the entire module. The
problem was mitigated by the fact that we process one function at a time, and
we start processing a new function less frequently.

II adopted the DominanceAnalysis structure. We should probably implement
this functionality as CRTP.

Swift SVN r26636
2015-03-27 16:55:36 +00:00
Michael Gottesman
52ec89a4ad [arc] Refactor out all BBState management from the evaluator into an ARCBBStateInfo class in GlobalARCSequenceDataflow.cpp. NFC.
This lets me hide a bunch of state in GlobalARCSequenceDataflow.h.

Swift SVN r26588
2015-03-26 10:40:52 +00:00
Michael Gottesman
876ad89f30 [arc] Move RefCountState's implementation into its own file. NFC.
ALso renamed the header ReferenceCountState.h => RefCountState.h since it
matches the name of the class now.

Swift SVN r26587
2015-03-26 09:17:50 +00:00
Michael Gottesman
39817d5fd8 Remove arc namespace.
Swift SVN r24500
2015-01-19 00:10:48 +00:00
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
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
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
87d18bc122 [g-arc-opts] Guaranteed parameters are always known safe.
If we have an argument that is guaranteed, the optimizer should always treat it
as known safe. This is good to do since we will eventually if I understand
correctly mark self as @guaranteed in methods. For now it will only be exposed
via function signature optimization.

rdar://18289318

Swift SVN r21834
2014-09-10 11:10:31 +00:00
Michael Gottesman
5561b3f538 Convert Nothing_t::Nothing => Nothing.
Swift SVN r21605
2014-08-30 03:11:55 +00:00
Michael Gottesman
56d51ca9f1 [g-arc-opts] Teach the ARC optimizer how to strip off ref count equivalent operations such as casts and ref count identity preserving typed geps.
Now that the ARC optimizer does not rely on stripCasts I also added
unchecked_trivial_bit_cast to stripCasts.

This and r21164 give the following speedups > 10%:

Ary      55.95%
MatMul   36.71%
Ary2     34.97%
Richard  32.08%
PrimeNum 15.87%

<rdar://problem/17456455>

Swift SVN r21240
2014-08-15 22:47:57 +00:00
Michael Gottesman
90b8849bb5 [g-arc-opts] When inserting new retain, releases use the stripped pointer of the first retain, not the original argument.
This can cause dominance problems if the first release is in a branch of a
switch and the final insertion point is in the switch merge point.

<rdar://problem/18015077>

Swift SVN r21192
2014-08-14 04:12:30 +00:00
Michael Gottesman
3ea14f47af [g-arc-opts] Only remove pairs, when we have the last release and the iterated retain property.
This came up when I was performing some cleanups to the merging in the ARC
optimizer.

Swift SVN r21112
2014-08-08 19:35:51 +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
7e37d3fcec [g-arc-opts] Ensure that if top down we are moving and bottom up we are eliminating (or vis-a-versa), we do nothing.
<rdar://problem/17420922>

Swift SVN r19310
2014-06-27 22:27:38 +00:00
Michael Gottesman
98649dada2 [global-arc-opts] It is not expected, but just in case we get more than INT_MAX BB, bail gracefully.
Swift SVN r19260
2014-06-26 22:18:44 +00:00
Michael Gottesman
2bf652fcb9 [g-arc-opts] Allow removing of increment, decrement pairs after seeing partial merges, ensuring that we still will not move them.
This enables us to handle significantly crazier control flow without
needing to worry about control dependency issues relating to different
groups of insertion points potentially not being control dependent which
can cause incorrect behavior in the optimizer.

Swift SVN r18861
2014-06-13 06:37:40 +00:00
Michael Gottesman
4b8a8efbef [g-arc-opts] Move all global arc optimizations under the same debug flag.
I wish we had the ability to specify a log grouping, so I could log all
of ARC opts or just a specific part of it. Sadly we don't have that now
so I am going to centralize them under the same flag.

Swift SVN r18820
2014-06-12 01:33:18 +00:00
Michael Gottesman
59c89e56ce [g-arc-opts] Change Global ARC Sequence Dataflow to use PreallocatedMap.
This will speed up the optimizer by reducing the amount of allocations
we perform while running the optimizer.

Swift SVN r18762
2014-06-09 23:09:04 +00:00
Michael Gottesman
125c206d3b Move BlotMapVector -> include/swift/Basic/BlotMapVector so it can be used in SILAnalysis and SILPasses. NFC.
Swift SVN r18736
2014-06-07 22:20:26 +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
5b3e77e622 [g-arc-opts] Implement the traversal of the RPOT, POT, forgetting all tracked instructions at loop boundaries.
<rdar://problem/17013194>

Swift SVN r18692
2014-06-01 23:03:52 +00:00
Michael Gottesman
483ba706be [g-arc-opts] Change ReferenceCountState to work on sets of instructions
instead of just individual instructions.

Swift SVN r18689
2014-06-01 22:22:23 +00:00
Michael Gottesman
3a07bdbcf7 [g-arc-opts] Remove #if 0 section I forgot to remove.
Swift SVN r18584
2014-05-23 03:50:54 +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
80f8b1a4ea [g-arc-opts] Extract out the dataflow from GlobalARCPairingAnalysis =>
GlobalARCSequenceDataflow. Add in the code to implement the bottom up
dataflow, but don't wire it up. Pass in the refactored top down dataflow
to the old pairing pass so we still give correct results.

The next step is to change the pairing analysis to use both the bottom
up and top down dataflow passes.

rdar://16965332

Swift SVN r18551
2014-05-22 02:17:28 +00:00
Michael Gottesman
6ddce0ad4b [g-arc-opts] Missing file from r18542.
Swift SVN r18544
2014-05-22 01:00:34 +00:00