Commit Graph

142 Commits

Author SHA1 Message Date
Nadav Rotem
dec5d764f4 Bring back the verify-after-all feature.
Swift SVN r13605
2014-02-06 23:27:33 +00:00
Nadav Rotem
27a1a63134 Remove unneeded empty virtual destructors.
Swift SVN r13599
2014-02-06 22:24:33 +00:00
Nadav Rotem
1ef0d157ca PassManager: Inject the function/module into the Transformation.
Now the pass does not need to know about the pass manager. We also don't have
runOnFunction or runOnModule anymore because the trnasformation knows
which module it is processing. The Pass itself knows how to invalidate the
analysis, based on the injected pass manager that is internal to the
transformation.

Now our DCE transformation looks like this:

class DCE : public SILModuleTransform {
  void run() {
    performSILDeadCodeElimination(getModule());
    invalidateAnalysis(SILAnalysis::InvalidationKind::All);
  }
};





Swift SVN r13598
2014-02-06 22:11:21 +00:00
Nadav Rotem
591a42aae3 Rename a few more pass factory methods.
Swift SVN r13588
2014-02-06 17:52:18 +00:00
Nadav Rotem
7cfb83449e Rename the pass to AllocBoxToStack
Swift SVN r13586
2014-02-06 17:43:54 +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
Michael Gottesman
098fda670f [sil-aa] Change SIL AliasAnalysis into an Analysis.
Swift SVN r13550
2014-02-06 02:29:41 +00:00
Nadav Rotem
f8c7b54d28 Delete the unused performXXX() functions.
Swift SVN r13531
2014-02-06 00:57:28 +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
Michael Gottesman
310fa94887 Fix typo. createDeadFunctionEmim => createDeadFunctionElimination.
Swift SVN r13508
2014-02-05 21:33:22 +00:00
Nadav Rotem
cf556b338f Migrate the diagnostics passes to the Pass Manager.
Swift SVN r13505
2014-02-05 20:38:34 +00:00
Nadav Rotem
7a50a4c79d Pass the Module in the pass manager constructor.
Swift SVN r13497
2014-02-05 20:00:18 +00:00
Nadav Rotem
a3bf2fe096 Small cleanups and comments. NFC.
Swift SVN r13496
2014-02-05 19:49:43 +00:00
Nadav Rotem
9a5aae49d9 Migrate the SIL optimization passes to using the new Pass Manager.
Swift SVN r13495
2014-02-05 19:46:04 +00:00
Michael Gottesman
71f33eef2c Convert the recent commits with DEBUG() => #ifndef NDEBUG. That is what they should really be using. I just had a thinko there.
Swift SVN r13279
2014-02-01 02:19:10 +00:00
Michael Gottesman
63c2dd1d5d Add support for SIL "paranoid verification" mode. Again this is disabled by default and will only run on a buildbot.
Swift SVN r13259
2014-02-01 00:59:01 +00:00
Michael Gottesman
10efd0b073 Add SILOptions as an argument to runSILDiagnosticPasses.
I am going to use this in a forthcoming patch which creates a special mode
called "ParanoidVerification" which runs the verifier after all passes.
"ParanoidVerification" will be by default off and will be used on the swift-fast
buildbot to help catch bugs which might be hidden by optimizations being run.

Swift SVN r13256
2014-02-01 00:30:53 +00:00
Jordan Rose
0820d82e20 Rename '-enable-arc-opts=false' to '-disable-arc-opts'.
Part of the migration to the new driver. With this commit, the only
failures in the test suite using the new frontend are features we don't
intend to port over. Hooray!

Swift SVN r13198
2014-01-31 02:34:37 +00:00
Jordan Rose
c7f1064527 Extract '-sil-inline-threshold' from the performance inliner.
Plumbing this through to the inliner necessitated the creation of a
SILOptions class (like FrontendOptions and IRGenOptions). I'll move
more things into this soon.

One change: for compatibility with the new driver, the option must be
specified as "-sil-inline-threshold 50" instead of "-sil-inline-threshold=50".
(We're really trying to be consistent about joined-equals vs. separate
in the new frontend.)

Swift SVN r13193
2014-01-31 01:52:12 +00:00
Nadav Rotem
230842221e Move the code motion optimizations into a new pass. NFC.
Swift SVN r13150
2014-01-30 17:32:57 +00:00
Michael Gottesman
49b0668831 Remove alloc_ref with simple destructors and only store users.
This pass attempts to remove alloc_ref and everything that uses the alloc_ref
if:

1. The alloc_ref has a destructor which we can very does not have escaping side
effects.
2. The alloc_ref does not have any non-trivial uses that are not stores.

It reduces ObjInst on my cpu from 10206922128 ns to 46 ns (i.e. nothing).

Swift SVN r12990
2014-01-27 08:59:20 +00:00
Nadav Rotem
1e78cc2170 Verify the module on every round of optimizations.
Swift SVN r12825
2014-01-23 00:25:37 +00:00
Michael Gottesman
7a9187f474 Add allocbox to stack after ARC opts in the pass order.
Swift SVN r12663
2014-01-21 22:01:42 +00:00
Nadav Rotem
3e5e965f50 Keep optimizing the module if some functions were devirtualzied.
Swift SVN r12661
2014-01-21 21:50:29 +00:00
Michael Gottesman
ae3b999925 Recommit "Very initial ARC optimizer implementation."
This recommits r12264 with the necessary changes to fix a bad thinko.

Swift SVN r12272
2014-01-14 03:08:52 +00:00
Dave Abrahams
9f99f02b24 Revert "Very initial ARC optimizer implementation."
This reverts commit r12264, which was breaking tests for me

Swift SVN r12270
2014-01-14 02:35:32 +00:00
Michael Gottesman
3650a75c99 Very initial ARC optimizer implementation.
For simplicity it currently only moves copy_values, strong_retains since we are
not doing the data flow analysis yet.

Even with its limitations (which are extreme), we are removing ~400
retain/release/copyvalue/destroyvalue pairs from the standard library.

Additionally we reduce the time RC4 takes from 7.5-5.5 (2 second delta).

Swift SVN r12264
2014-01-14 01:09:00 +00:00
Nadav Rotem
970c387c34 Refactor devirt related optimizations from sil-combine into a new pass.
The reason is that I would like to add more sophisticated analysis and a
chache, which does not fit into sil-combine very well.



Swift SVN r12221
2014-01-13 07:34:25 +00:00
Nadav Rotem
526988de3b Run the optimizer in a loop until we can't specialize any more. For stdlib we run the optimizations 3 times.
Swift SVN r12018
2014-01-07 23:05:48 +00:00
Michael Gottesman
0100b2a75c [sil-sroa] SIL Scalar Replacement of Aggregates.
Swift SVN r11918
2014-01-06 03:44:54 +00:00
Michael Gottesman
612d622290 Rename current SILSROA => SILLowerAggregateInstrs.
Swift SVN r11739
2013-12-30 08:21:19 +00:00
Nadav Rotem
75803a402e Change the pass order.
The main difference is that the specializer is moved to the beginning of the pipe. This makes sense because it does not depends on other optimizations.



Swift SVN r11738
2013-12-30 07:51:20 +00:00
Michael Gottesman
d6bf276e88 [sil-sroa] Very initial simple initial commit of SILSROA. Currently only lowers
copy_addr, destroy_addr into their constituant parts without performing any
chopping to unblock Nadav.

The plan is to use type lowering to chop these up and then rewrite afterwards.
But for now I want to unblock Nadav.

Swift SVN r11728
2013-12-30 00:17:37 +00:00
Nadav Rotem
faab3ca3d8 Reduce the inliner threshold and enable the early inliner.
The compile times of stdlib drops by a few seconds and the code quality of a few small testcases that
I have been playing with improves.



Swift SVN r11718
2013-12-29 18:33:38 +00:00
Nadav Rotem
37de1eb542 Add SILCombine again because r11688 fixed a bug that made NewString fail.
Swift SVN r11689
2013-12-28 07:37:19 +00:00
Dave Abrahams
be071a469e Revert r11670: "Add SILCombine after specialization and inlining to remove unused functions."
That commit broke test/stdlib/NewString.swift

Swift SVN r11677
2013-12-27 21:52:57 +00:00
Nadav Rotem
6e74bb154e Add SILCombine after specialization and inlining to remove unused functions.
This removes 1000 functions from the standard library.



Swift SVN r11670
2013-12-27 07:57:48 +00:00
Chris Lattner
b8c2bc4ebd disable the performance inliner for now. It dramatically slows down
the build time of the stdlib (primarily in the llvm IR and later passes) 
by generating a ton more code that needs to be compiled.



Swift SVN r11631
2013-12-25 17:24:03 +00:00
Nadav Rotem
55fec18c32 Add the inliner before reg2mem to allow more opportunity of the scalar optimizers to kick-in.
Swift SVN r11626
2013-12-24 22:20:03 +00:00
Michael Gottesman
3a80eca8b6 Remove some testing code that snuck in in r11595.
Swift SVN r11605
2013-12-23 06:58:36 +00:00
Michael Gottesman
b6f8bd9a55 Initial simple cost based performance inliner.
This is a very initial version mostly to get machinery in place before we start
considering more interesting things.

Specifically we do not:

1. Inline functions with any substitutions.
2. Inline functions that are not thin.
3. Inline functions in any recursive manner (i.e. we just follow the call tree
and inline until we run out of cost).
4. Remove functions that we have completely inlined as a good citizen should.

Additionally the cost model is purposely simplistic and assumes that every SIL
instruction is one to one with an LLVM instruction (when many do not become any
LLVM instruction and others become 2). The idea is simply to put a cost on the
total increase in code size we allow due to inlining in a specific function.
Thus we just continually inline until we run out our inlining budget.

Even with the current limitations we inline 1248 apply inst in the stdlib when
setting a cost threshold of 225.

Swift SVN r11596
2013-12-23 06:00:57 +00:00
Connor Wakamo
425807ce95 Move runSILDiagnosticPasses and runSILOptimizationPasses into swiftSILPasses.
Added a new Passes.cpp file to swiftSILPasses, which contains the general SIL pass-related functions.
Moved runSILDiagnosticPasses and runSILOptimizationPasses from tools/swift/Helpers.cpp to lib/SILPasses/Passes.cpp so that the functions can be shared by swift and swift_driver.

Swift SVN r11382
2013-12-17 05:15:34 +00:00