Commit Graph

24 Commits

Author SHA1 Message Date
Arnold Schwaighofer
06a0a23562 Add a destructor memory effect analysis
This adds an analysis to the compiler that identifies types that are may store
to memory on destruction.

It adds a compiler known protocol _DestructorSafeContainer that allows the
standard library to identify containers whose destructor's memory effects
depends strictly on the type parameters of the container.

Array<T> : _DestructorSafeContainer {} may not store to memory during
destruction if the bound T is a type that does not store to memory on
destruction.

This is needed to deduce that for example Array<Array<Int>> is does not store to
memory on destruction (e.g during a call to release).

rdar://18940376

Swift SVN r23242
2014-11-11 19:27:41 +00:00
Michael Gottesman
04d9f968fd [rc-id] Make sure when stripping off arguments that the resulting stripped value dominates the argument.
This is important since to be more aggressive we are ignoring incoming values
that are no-payload enums since as far as we are concerned they do not matter
since retains, releases on those values are no-ops.

Swift SVN r21932
2014-09-12 22:21:06 +00:00
Michael Gottesman
4647eb9601 Create RCIdentityAnalysis a cache for stripRCIdentityPreservingOps.
The cache is needed to ensure we do not run into compile time problems once we
start looking through Phi Nodes.

The analysis is currently disabled and just returns
SILValue::stripRCIdentityPreservingOps. I am going to thread it through the rest
of the passes that use that call. Then I am going to hide
stripRCIdentityPreservingArgs. Finally post OzU, I am going to enable the pass.

rdar://18300069

Swift SVN r21891
2014-09-11 21:51:29 +00:00
Nadav Rotem
898bf23738 Move the CallGraphAnalysis to a new file.
Swift SVN r20714
2014-07-29 23:18:56 +00:00
Nadav Rotem
7faa5883df Add a basic Class Hierarchy Analysis. At this point it only lists classes that are inherited from in this module.
Swift SVN r20710
2014-07-29 23:01:01 +00:00
Arnold Schwaighofer
12cb97d284 PassManager: Reset state and remove all currently owned transformations
In the current setup analysis information is not reused by new pass managers.
There is no point in having different pass managers. Instead, we can just remove
transformations, reset the internal state of the pass manager, and add new
transformation passes. Analysis information can be reused.

Reuse one pass manager in the pass pipeline so that we don't have to
unnecessarily recompute analysis information.

Swift SVN r19917
2014-07-14 03:42:39 +00:00
Michael Gottesman
7d5751594d Add in a post order analysis that lazily recomputes post orders for functions when they are invalidated.
This ensures that if we have a bunch of passes in a row which modify the CFG, we
do not continually rebuild the post order, while at the same time preserving the
property of multiple passes which do not touch the CFG sharing the same post
order, reverse post order rather than recomputing them.

rdar://17654239

Swift SVN r19913
2014-07-14 01:32:24 +00:00
Mark Lacey
021983017a Add a SIL SCC visitor and an induction variable analysis.
The induction variable analysis derives from the SCC visitor CRTP-style
and uses it to drive analysis to find the IVs of a function.

The current definition of induction variable is very weak, but enough to
use for very basic bounds-check elimination.

This is not quite ready for real use. There is an assert that I've
commented out that is firing but should not be, and that will require
some more investigation.

Swift SVN r19845
2014-07-11 02:48:03 +00:00
Andrew Trick
53cbc3e858 Add a ColdBlockInfo analysis based on DominanceAnalysis.
This will be used by PerformanceInliner, GlobalOpt, and other passes in the future.

Swift SVN r19454
2014-07-02 06:35:09 +00:00
Arnold Schwaighofer
a14aa42ce1 SILLoopInfo: Implement SIL loop info analysis using LLVM's LoopInfo
Swift SVN r18718
2014-06-05 22:25:42 +00:00
Michael Gottesman
1f93ec5480 [devirtualization] Remove deep devirtualization code that we are not using for WWDC.
If we decide in the future to do this we can always revert this commit.

Swift SVN r17293
2014-05-03 00:33:46 +00:00
Manman Ren
c2f32d7e24 [Inliner] revert r17101 since it causes a performance regression on MD5.
See rdar://16676020 for details.
r17101 tries to solve r16761933 by checking non-direct recursions in
the call graph. We are in discussion of solving it in a different way.

Todo: figure out why r17101 causes a preformance regression.


Swift SVN r17265
2014-05-02 19:00:36 +00:00
Nadav Rotem
e406e43060 Disable the inlining of non-direct recursions (where A->B->A).
Swift SVN r17101
2014-04-30 18:45:13 +00:00
Andrew Trick
90bdf1f841 Run a sequence of SILFunctionTransforms on the same function.
It is much easier to follow the progreses of optimizations. And should
be more efficient.

Swift SVN r13678
2014-02-08 08:20:46 +00:00
Andrew Trick
4da216c7c7 Add a PassManager analysis that tracks changed/complete functions.
Don't print/verify unless something has changed.
Don't rerun function passes on functions that have not changed.

Swift SVN r13675
2014-02-08 08:20:44 +00:00
Andrew Trick
04b2b5256b First implementation of <rdar://15922760> Deep devirtualization -
specialize on polymorphic arguments.

This can be enabled with: -sil-devirt-threshold 500.

It currently improves RC4 (when enabled) by 20%, but will be much more
important after Michael's load elimination with alias analysis lands.

This implementation is suitable for experimentation. Superficial code
reviews are also welcome. Although be warned that the design is overly
complex and I plan to rewrite it. I initially abandoned the idea of
incrementally specializing one function at a time, thinking that we
need to analyze full chains. However, I since realized after talking
to Nadav that the incremental approach can be made to work. A lot of
book-keeping will go away with that change.

TODO:

- Resolve protocol argument types. Currently we assume they can be
  reinitialized at applies, but I don't think they can unless they are
  @inouts.  This is an issue with the existing local devirtualizer
  that prevents it working across calls.

- Properly mangle the specialized methods. Find existing
  specializations by demangling rather than maintaining a map.

- Rewrite the logic for specializing chains for simplicity.

- Enable by default.

Swift SVN r13642
2014-02-07 19:10:27 +00:00
Nadav Rotem
0651b9bbd0 Add a new Dominance Analysis that wraps DomInfo and PDomInfo, and migrate the
passes that use them.



Swift SVN r13571
2014-02-06 07:52:16 +00:00
Nadav Rotem
5155177333 Fix a spelling mistake.
Swift SVN r13560
2014-02-06 04:32:00 +00:00
Michael Gottesman
a4a0e09b1b Remove alias analysis invalidation.
Swift SVN r13558
2014-02-06 04:31:07 +00:00
Nadav Rotem
d6802340fe Change the CallGraph Analysis API and add cacheing and invalidation methods.
Swift SVN r13554
2014-02-06 04:24:51 +00:00
Michael Gottesman
098fda670f [sil-aa] Change SIL AliasAnalysis into an Analysis.
Swift SVN r13550
2014-02-06 02:29:41 +00:00
Nadav Rotem
93b5cac34e Remove the top-down call graph ABI and use the reverse bottom-up.
Swift SVN r13544
2014-02-06 01:52:14 +00:00
Michael Gottesman
03d16cfce2 Fix header guards to match reset of headers. NFC.
Swift SVN r13524
2014-02-05 23:41:33 +00:00
Michael Gottesman
20f2f45703 In light of the new swiftAnalysisLibrary, move lib/SILPasses/Analysis.cpp => lib/SILAnalysis/Analysis.cpp and perform the analogous change for Analysis.h.
Swift SVN r13523
2014-02-05 23:37:36 +00:00