Commit Graph

769 Commits

Author SHA1 Message Date
Erik Eckstein
90c21be191 Unify the implementation of optimization mode in various option classes.
This commit is mostly refactoring.

*) Introduce a new OptimizationMode enum and use that in SILOptions and IRGenOptions
*) Allow the optimization mode also be specified for specific SILFunctions. This is not used in this commit yet and thus still a NFC.

Also, fixes a minor bug: we didn’t run mandatory IRGen passes for functions with @_semantics("optimize.sil.never")
2017-11-14 11:25:02 -08:00
David Ungar
45bf920654 Formatted. 2017-11-13 15:03:52 -08:00
David Ungar
495aeeca3f Change enum ActionType to enum class ActionType. 2017-11-13 14:53:18 -08:00
Doug Gregor
5d5e6122f3 [GSB] Add verification of all generic signatures within a module.
Add a verification pass to ensure that all of the generic signatures in
a module are both minimal and canonical. The approach taken is quite
direct: for every (canonical) generic signature in the module, try
removing a single requirement and forming a new generic signature from
the result. If that new generic signature that provide the removed
requirement, then the original signature was not minimal.

Also canonicalize each resulting signature, to ensure that it meets the
requirements for a canonical signature.

Add a test to ensure that all of the generic signatures in the Swift
module are minimal and canonical, since they are ABI.
2017-11-07 15:20:38 -08:00
Arnold Schwaighofer
56a1663c98 Merge pull request #12658 from rajbarik/master
Improve Osize
2017-10-30 07:23:49 -07:00
swift-ci
dfbcccfb75 Merge pull request #12585 from anemet/save-opt-record 2017-10-27 11:09:50 -07:00
Raj Barik
c0b7cf0ff5 Expose UnrollThreshold and Inline_Benefit_reduction in the command line for automatic code size tuning 2017-10-27 10:30:23 -07:00
Adam Nemet
66085a8aef Save optimization remarks in an external YAML file
This brings the capability from clang to save remarks in an external YAML files.
YAML files can be viewed with tools like the opt-viewer.

Saving the remarks is activated with the new option -save-optimization-record.

Similarly to -emit-tbd, I've only added support for single-compile mode for now.
In this case the default filename is determined by
getOutputFilenameFromPathArgOrAsTopLevel, i.e. unless explicitly specified
with -save-optimization-record-path, the file is placed in the directory of the
main output file as <modulename>.opt.yaml.
2017-10-27 10:14:27 -07:00
Graydon Hoare
30b6fdce83 Merge pull request #12429 from graydon/named-lazy-member-loading
Named lazy member loading 1/N
2017-10-24 14:27:04 -07:00
Roman Levenstein
5047e1b475 Enable the serialization of sil_vtables by default and completely remove the -sil-serialize-vtables option
Only sil_vtables of public classes with fixed layout are serialized.
2017-10-21 11:36:12 -07:00
Roman Levenstein
f2e8e0a448 Merge pull request #12493 from swiftix/sil-serialization-before-optimizations5
Enable serialization of witness tables by default
2017-10-21 08:40:59 -07:00
Graydon Hoare
6bb5ce3d1e [NamedLazyMemberLoading] Add -enable-named-lazy-member-loading option 2017-10-20 22:48:42 -07:00
Roman Levenstein
48d9b99675 Remove -sil-serialize-witness-tables flag completely
The functionality is always enabled now and there is no need to have a dedicated flag for it.
2017-10-20 19:45:29 -07:00
Adam Nemet
9b9805420d Add optimization remarks
This allows reporting successful and unsuccessful optimizations similar to
clang/llvm.

This first patch adds support for the
options -Rpass=<pass-name-regex> -Rpass-missed=<pass-name-regex>.  These allow
reporting successful/unsuccessful optimization on the compiler output for passes
specified by the regex.  I've also added one missed and one passed remark type
to the inliner to test the infrastructure.

Clang also has the option of collecting these records in an external YAML data
file.  This will be added in a later patch.

A few notes:
* The goal is to use this facility for both user-lever "performance" warnings
and expert-level performance analysis.  There will probably be a flag in the
future differentiating the verbosity.

* The intent is match clang/llvm as much as it makes sense.  On the other hand I
did make some changes.  Unlike in llvm, the emitter is not a pass which
simplifies things.  Also the remark class hierarchy is greatly simplified since
we don't derive from DiagnosticInfo.  We also don't derive from Diagnostic to
support the streaming API for arbitrary named-value pairs.

* Currently function names are printed mangled which should be fixed.
2017-10-20 12:41:37 -07:00
David Ungar
7d637c856c Merge pull request #12335 from davidungar/primaryFilesMode-Inputs-rebased
NFC: First step (refactoring) towards speeding up compilation w/ >1 primary file
2017-10-10 12:55:55 -07:00
Saleem Abdulrasool
54f80d9f32 Frontend: simplify some flag logic (NFC)
Using the three parameter form of `hasFlag` makes it possible to fold
away the conditional code.  NFC.
2017-10-09 14:42:34 -07:00
David Ungar
47ee930a50 git-clang-format'ed 2017-10-08 23:56:03 -07:00
David Ungar
c1821755de NFC: First step (refactoring) towards speeding up compilation by having multiple primary files: Creates new class, FrontendInputs, to encapsulate InputFilenames, InputBuffers, and PrimaryInput, which were formerly in FrontendOptions. Add new instance variable, Inputs, to FrontendOptions in order to hold FrontendInputs.
Encapsulate uses of the variables in FrontendInputs with intention-describing functions. Move some code that sets these variables into FrontendInputs and FrontendOptions classes.

Create new FrontendInputs class to encapsulate InputFilenames, InputBuffers and PrimaryInput, which were formerly in Frontend.

Includes one change in SwiftEditor.cpp to resolve a merge conflict.
2017-10-08 10:20:37 -07:00
Roman Levenstein
5e67f755e0 Remove the -sil-serialize-all option 2017-10-04 14:20:53 -07:00
Roman Levenstein
e0d3175db4 Add a new option -sil-serialize-vtables
This option needs to be used if vtables should be serialized. The primary use-case for this option is when you build the standard library.
2017-10-02 14:34:14 -07:00
Vedant Kumar
1621facc6c [SwiftPGO] Add driver support for -profile-use=<path>
This option tells the compiler where to find a profdata file. The
information in this file enables PGO. For more information about the PGO
infrastructure, look for the -profile-generate option and for the
llvm-profdata tool [1].

[1] http://llvm.org/docs/CommandGuide/llvm-profdata.html
2017-09-26 10:52:08 -07:00
Graydon Hoare
994ad7ad92 [stats] Add -trace-stats-events 2017-09-22 19:16:50 -04:00
Joe Groff
2ba8f57514 Remove staging flag for unimplemented key path components.
All the originally-planned component kinds are now implemented.
2017-09-15 11:55:35 -07:00
Arnold Schwaighofer
9535f8be32 Frontend: Add an Osize optimization option
This adds an size optimization mode ("Osize") which intends to enable some
optimization but targets mainly reduced code size compared to the regular
optimized mode ("O").

rdar://33075751
2017-08-17 14:57:21 -07:00
George Karpenkov
efe143c2f4 Adding support for -sanitize=fuzzer flag (#11381)
Similarly to Clang, the flag enables coverage instrumentation, and links
`libLLVMFuzzer.a` to the produced binary.
Additionally, this change affects the driver logic, and enables the
concurrent usage of multiple sanitizers.
2017-08-07 18:16:51 -07:00
Arnold Schwaighofer
f442dd93bd CompilerInvocation: If no optimization flag is set default to Onone
I noticed in a follow-up patch that if you just swiftc without passing Onone
these flags are not set and sometimes happen to default to right thing ... or
not; as can be seen by the test cases modified. For example, at Onone we are
supposed to include an extra swift module "SwiftOnoneSupport".
2017-08-04 11:49:16 -07:00
Kuba (Brecka) Mracek
d046f3f959 Set _swift_reportFatalErrorsToDebugger to true by default and remove all the staging parts (frontend flag, irgen changes). (#11329) 2017-08-03 15:23:23 -07:00
swift-ci
135b3c98f1 Merge remote-tracking branch 'origin/master' into master-next 2017-08-02 14:29:41 -07:00
Huon Wilson
53ebbf0f18 Merge pull request #11305 from huonw/tbd-install-name
Add -tbd-install_name
2017-08-02 14:21:57 -07:00
Huon Wilson
a6e4fdb887 [Frontend] Add -tbd-install_name frontend argument. 2017-08-02 11:33:54 -07:00
swift-ci
d549147e43 Merge remote-tracking branch 'origin/master' into master-next 2017-07-31 18:48:50 -07:00
Huon Wilson
374826c960 Merge pull request #11219 from huonw/tbd-is-not-a-main-product
[Frontend] Emit tbd as an extra output, not a frontend action.
2017-07-31 18:46:02 -07:00
Huon Wilson
dfa8501e59 [Frontend] Emit tbd as an extra output, not a frontend action.
This means it can be emitted during an -emit-module frontend job, which is the
most common place it will be used, so reusing work like this is important for
performance.

For now, this has to happen as part of a single frontend invocation, i.e. -wmo
or -force-single-frontend-invocation.
2017-07-31 11:05:29 -07:00
Chris Bieneman
9c35042ae6 Merge remote-tracking branch 'origin/master' into master-next 2017-07-28 09:51:36 -07:00
John McCall
b097197d28 Merge pull request #11216 from rjmccall/optimize-emit-pch-job
Pass optimization options to the -emit-pch job
2017-07-27 11:36:31 -04:00
John McCall
dda3a3827c [SR-3063] Suppress SIL transforms when merging modules. 2017-07-27 10:21:02 -04:00
Doug Gregor
469e9e08a5 SE-0157: Enable recursive protocol constraints by default.
We don't know if they work in general, but specific cases of recursive
protocol constraints are working, and enabling them doesn't break
anything.
2017-07-26 20:57:24 -07:00
swift-ci
6d7415e0da Merge remote-tracking branch 'origin/master' into master-next 2017-07-25 22:09:00 -07:00
John McCall
c893e955aa Propagate "-O" to Clang (as "-Os").
It affects Clang IRGen, among other things.
2017-07-26 00:32:08 -04:00
swift-ci
f6a4fb6b5c Merge remote-tracking branch 'origin/master' into master-next 2017-07-21 14:28:51 -07:00
Harlan
37f88e7372 Add frontend flag to serialize Syntax tree (#11095)
* Add frontend flag to serialize Syntax tree

* Rename dump-serialized-syntax-tree to emit-syntax
2017-07-21 14:23:50 -07:00
Bob Wilson
5f02db4d3e Merge remote-tracking branch 'origin/master' into master-next 2017-07-20 21:59:23 -07:00
Pavel Yaskevich
4f8872598b [ConstraintSolver] NFC: Add option to control early termination of shrinking phase
Currently we have a number of unsolved disjunctions hard-coded to 5,
which breaks some existing code by terminating shrinking too early.
This patch makes it a command-line option so users have control over
what that threshold can be.

Resolves: rdar://problem/33433595
2017-07-20 12:44:48 -07:00
swift-ci
11be60f113 Merge remote-tracking branch 'origin/master' into master-next 2017-07-13 23:28:50 -07:00
Mark Lacey
ed23eb3761 Revert "SE-0157: Enable recursive protocol constraints by default."
This reverts commit afbdbae9d9.

Commit ded45a6e1c more than triples the
type checking time when building Swift.o, so I am going to revert that ,
and it looks like this needs to be reverted as well if that commit is
reverted.
2017-07-13 16:05:03 -07:00
swift-ci
49734ce454 Merge remote-tracking branch 'origin/master' into master-next 2017-07-13 14:28:51 -07:00
Doug Gregor
afbdbae9d9 SE-0157: Enable recursive protocol constraints by default.
We don't know if they work in general, but specific cases of recursive
protocol constraints are working, and enabling them doesn't break
anything.
2017-07-13 13:01:11 -07:00
swift-ci
cfc6eeede4 Merge remote-tracking branch 'origin/master' into master-next 2017-07-12 16:48:52 -07:00
Doug Gregor
70b75491a0 SE-0157: Add a frontend flag -enable-recursive-constraints.
Introduce `-enable-recursive-constraints` to disable the error about
direct recursion within a protocol definition. The implementation of
recursive protocol constraints is incomplete, but might be useful for
experimentation.
2017-07-12 14:55:55 -07:00
swift-ci
e98182387b Merge remote-tracking branch 'origin/master' into master-next 2017-07-11 12:23:35 -07:00