Commit Graph

30 Commits

Author SHA1 Message Date
Erik Eckstein
160b8e07db SILPassManager: A new method to reduce the number of SIL pass runs.
It avoids that a pass runs a second time if didn't make any changes in the previous run and no other pass changed the function in between.
rdar://problem/20336764

In this change I also removed the CompleteFunctions analysis which is now obsolete.

Some measurements with swiftbench (-wmo, single threaded):
It reduces the number of pass runs by about 28%. Because only passes are skipped that don't do anything, the effect on compile time is not so dramatic.
The time spent in runSILOptimizationPasses is reduced by ~9% which gives a total compile time reduction of about 3%.




Swift SVN r26757
2015-03-31 14:19:51 +00:00
Erik Eckstein
f520ef894a Add the PassKind as a property in SILTransform.
To set the PassKind automatically, I needed to refactor some code of the pass manager and the pass definitions.
The main changes are:
1) SILPassManager now has an add-function for each pass: PM.add(createP()) -> PM.addP()
2) I removed the ARGS argument in Passes.def, which we didn't use anyway.



Swift SVN r26756
2015-03-31 14:08:19 +00:00
Nadav Rotem
d78b376d07 [passes] Replace the old invalidation lattice with a new invalidation scheme.
The old invalidation lattice was incorrect because changes to control flow could cause changes to the
call graph, so we've decided to change the way passes invalidate analysis.  In the new scheme, the lattice
is replaced with a list of traits that passes preserve or invalidate. The current traits are Calls and Branches.
Now, passes report which traits they preserve, which is the opposite of the previous implementation where
passes needed to report what they invalidate.

Node: I tried to limit the changes in this commit to mechanical changes to ease the review. I will cleanup some
of the code in a following commit.

Swift SVN r26449
2015-03-23 21:18:58 +00:00
Mark Lacey
58b00f84ed Unindent code within namespace.
Swift SVN r26433
2015-03-23 15:18:38 +00:00
Nadav Rotem
5ad8aeef25 [PM] Teach the pass manager about locked analysis that should not be invalidated.
Swift SVN r26375
2015-03-20 22:53:08 +00:00
Nadav Rotem
4ba1dc2259 Update the smallvector size to match the number of passes and analysis we are using.
Swift SVN r26373
2015-03-20 22:53:06 +00:00
Nadav Rotem
663482ea93 Split the debugging feature to set the pass name inside the PassManager resetAndRemoveTransformations into a new function.
Swift SVN r25562
2015-02-26 21:01:46 +00:00
Michael Gottesman
4a34f25c6b Add support for verifying analyses when -sil-verify-all is passed in.
Currently no passes implement this, but I am going to add support to the
callgraph. I just ran into a callgraph bug that this would have helped
to catch.

rdar://19930214

Swift SVN r25514
2015-02-24 22:49:46 +00:00
Andrew Trick
6cc72ee21b Print SIL optimization stages. SIL debugging.
Swift SVN r23902
2014-12-12 23:57:03 +00:00
Michael Gottesman
123b8e6f61 Access SILOptions in SILPassManager via the SILModule now that we store the SILOptions in the SILPassManager.
Swift SVN r23651
2014-12-03 20:39:05 +00:00
Nadav Rotem
6358d67a73 Cleanup the optimization driver. NFC.
Swift SVN r21058
2014-08-06 01:02:09 +00:00
Michael Gottesman
e9a7f91667 Revert "Add the frontend option -disable-sil-perf-optzns."
Revert "For debugging purposes allow passes to stop any more passes from running by calling PassManager::stopRunning()."

This reverts commit r20604.
This reverts commit r20606.

This was some debugging code that snuck in.

Swift SVN r20615
2014-07-28 06:21:30 +00:00
Michael Gottesman
7136c53208 For debugging purposes allow passes to stop any more passes from running by calling PassManager::stopRunning().
The intended use case is the user puts in a counter and wants the pass manager
to ensure that no further passes run.

Swift SVN r20606
2014-07-27 18:37:12 +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
70274f31bc [sil-pass-manger] Do not use an LLVM statistic as the counter when deciding that we have iterated too many times. They are compiled out with a release compiler.
Swift SVN r18576
2014-05-22 23:16:05 +00:00
Doug Gregor
b902c5e5eb Revert "Limit PassManager to 25 reschedule iterations as a workaround for <rdar://problem/16591598>."
This reverts commit r16221. We don't need this limit.

Swift SVN r16314
2014-04-14 14:31:15 +00:00
Doug Gregor
8f39464b05 Limit PassManager to 25 reschedule iterations as a workaround for <rdar://problem/16591598>.
Swift SVN r16221
2014-04-11 17:34:36 +00:00
Joe Groff
c0a0a8b584 Add a -sil-opt-pass-count frontend flag.
Until our SIL printing and parsing is robust enough to round-trip, this is useful for bisecting optimizer issues.

Swift SVN r14061
2014-02-18 23:37:25 +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
47b936fbae Let passes get their options (current configuration) from the
PassManager.

I think this is much cleaner and more flexible. The various pass
builders have no business marshalling these things around, and they
shouldn't be bound to the pass C'tor. In the future we will be able
override and dynamically modify pass configuration this way.

Swift SVN r13626
2014-02-07 05:01:00 +00:00
Nadav Rotem
dec5d764f4 Bring back the verify-after-all feature.
Swift SVN r13605
2014-02-06 23:27: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
abed15c3c3 Add the runOneIteration method to the Pass Manager.
Swift SVN r13580
2014-02-06 17:13:13 +00:00
Michael Gottesman
3b43e09bae Change getAnalysis<T> to be asserting and provide a new entry point getAnalysisOrNull<T>. Remove all of the unneeded asserts in the various passes.
Swift SVN r13576
2014-02-06 10:06:18 +00:00
Nadav Rotem
4cf4ab7c5b Comments and random cleanups.
Swift SVN r13572
2014-02-06 07:57:40 +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
631f9326ab [PM] Change enum => enum class everywhere in the PM code. Additionally fix some typos.
Swift SVN r13507
2014-02-05 21:25:15 +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
72169c305d Initial swift pass manager.
Swift SVN r13492
2014-02-05 18:56:16 +00:00