Robert Widmann
2a7eee86fc
Merge pull request #8908 from CodaFi/space-engine
...
Redo Exhaustiveness Analysis
2017-04-28 21:28:31 -04:00
Slava Pestov
221df61a6e
SILOptimizer: Clean up SubstitutionMap usage in devirtualizer
2017-04-28 13:26:03 -07:00
Slava Pestov
3130c3cbd7
AST: Remove an overload of GenericSignature::getSubstitutions()
2017-04-28 13:26:02 -07:00
Robert Widmann
42c59554a0
Introduce the Space Engine
...
Implement exhaustiveness checking in Sema with rich error messages. The
algorithm used is a variant of the one described in Fengyun Liu's paper
"A Generic Algorithm for Checking Exhaustivity of Pattern Matching"
published in the EPFL conference, and Luc Maranget's seminal paper
"Warnings for Pattern Matching"
The Space Engine views pattern matching as a problem of projecting the
scrutinee of a pattern-match into a "Space", then iteratively
constructing a Space from the cases. Taking the difference of this
master space and the covered spaces yields the "holes" left over or
reveals a completely covered space.
The algorithm also extends trivially to redundancy checks in patterns,
but that check is already implemented in SILGen and this algorithm does
not improve upon it.
2017-04-28 02:06:39 -04:00
Erik Eckstein
cc2dc79435
fix typo in comment
2017-04-27 16:53:54 -07:00
Erik Eckstein
c343ab6907
ArrayElementValuePropagation: fix a wrong substituted function type for the generated reserveCapacity function call
2017-04-27 14:50:58 -07:00
Erik Eckstein
76eca003bb
ArrayElementValuePropagation: explicitly reserve space for new elements when doing the array-content-of optimization
...
When Array.append(contentOf:) is replaced by individual Array.append(element) calls, an explicit reserveCapacityForAppend is inserted.
2017-04-27 09:06:56 -07:00
Erik Eckstein
9ac13ae606
stdlib, optimizer: add Array. reserveCapacityForAppend as a new array semantics operation.
...
This function reserves capacity in an Array for new elements which are about to be appended.
2017-04-27 09:06:55 -07:00
Erik Eckstein
e3ae6f29b6
SimplifyCFG: improve jump threading for switch_enum
...
1) to find a threading candidate for a branch instruction, look through multiple successor blocks and not only in the immediate successor
2) handle SSA-cycles when getting the case for an enum value
2017-04-27 09:06:55 -07:00
Erik Eckstein
d4cbc48e40
SILCombine: replace switch_value of Builtin.Int1 with a cond_br
...
cond_br is more common and can be handled by more optimizations
2017-04-27 09:06:55 -07:00
Roman Levenstein
ab167ac41c
Merge pull request #9053 from swiftix/partial-specialization-fixes
...
[sil-combine] Fix a subtle bug in getConformanceAndConcreteType related to handling of inherited conformances
2017-04-26 23:38:42 -07:00
Roman Levenstein
48b1f16f0b
Simplify code
2017-04-26 23:07:48 -07:00
Roman Levenstein
e144d0f40e
[sil-combine] Do not form the SubstitutionList by hand. Use SubstitutionMap APIs for it.
2017-04-26 23:07:41 -07:00
Roman Levenstein
28d7f80c24
[sil-combine] Fix a subtle bug in getConformanceAndConcreteType related to handling of inherited conformances
...
This fixes a couple of tests and some of the compatibility suite projects.
rdar://problem/31815540, rdar://problem/31838976
2017-04-26 23:07:32 -07:00
Saleem Abdulrasool
8741e4cd20
Merge pull request #8971 from compnerd/siloptimizer-iwyu
...
SILOptimizer: IWYU CommandLine.h (NFC)
2017-04-26 20:08:38 -07:00
swift-ci
962c71a2f1
Merge pull request #9056 from atrick/access
2017-04-26 18:10:28 -07:00
Andrew Trick
e8b0947897
[Exclusivity] Allow testing the -Onone pipeline with access markers.
...
Markers are always eliminated before -O passes.
At -Onone, markers can be enabled via command line for all -Onone passes.
2017-04-26 17:32:48 -07:00
Michael Gottesman
237a00bc07
[upstream-update] Include a header directly rather than relying on transitive includes.
...
This causes breakage with some changes coming from upstream.
2017-04-26 16:50:13 -07:00
Roman Levenstein
c897316a8c
[sil-generic-specializer] Fix bugs in the implementation of partial specialization for partial_apply
...
Do not forget to map interface types to proper contextual types.
2017-04-26 13:02:24 -07:00
Roman Levenstein
7bc012ab16
[sil-generic-specializer] Set a generic context a bit earlier so that all functions using type-lowering can use it.
...
Fixes rdar://31838976 (SR-4704)
2017-04-26 11:37:59 -07:00
Roman Levenstein
30a50f9ef0
[sil-cast-optimizer] Fix a silly bug related to canonical types
...
This bug occurs in real projects, when type aliases are involved.
The test-case is a bit hard to provide. I’ll try to provide it later, if I managed to reduce the original project to a small test-case.
But the fix is very obvious.
Fixes rdar://31768258
2017-04-26 09:49:14 -07:00
Andrew Trick
0f70130852
[Exclusivity] Eliminate unpaired access instructions before optimization.
2017-04-26 09:02:47 -07:00
Andrew Trick
b872ae80c1
[Exclusivity] AccessMarkerEnforcementSelection support for unpaired markers.
2017-04-26 09:02:34 -07:00
Andrew Trick
f00381933b
[Exclusivity] Fix PredictableMemOps to handle access markers.
2017-04-26 09:00:50 -07:00
practicalswift
ab5aaeb359
Merge pull request #9001 from practicalswift/gardening-20170425
...
[gardening] Unused variables. Unused diagnostics. Namespace comments. Typos.
2017-04-26 09:28:24 +02:00
Andrew Trick
39cd8126a6
[Exclusivity] Reenable AccessEnforcementSelection assert.
2017-04-25 15:58:11 -07:00
swift-ci
6ca9bc5b6f
Merge pull request #9006 from DougGregor/bridge-cast-optimize-downcast
2017-04-25 14:16:29 -07:00
Doug Gregor
f7e05fd951
[Bridging cast optimization] Unchecked casts can perform a class downcast.
...
Handle a class downcast following a bridging cast. Fixes
rdar://problem/31791421.
2017-04-25 13:43:06 -07:00
practicalswift
ff827e0455
[gardening] Fix recently introduced typos
2017-04-25 21:03:44 +02:00
practicalswift
861f70e13d
[gardening] Use consistent spacing
2017-04-25 21:03:43 +02:00
Michael Gottesman
a89752f77a
[gardening] Eliminate unused variable warnings from non-asserts build.
2017-04-24 16:08:06 -07:00
swift-ci
94f4ee6df0
Merge pull request #8976 from atrick/access
2017-04-24 15:18:17 -07:00
Andrew Trick
e461f4809c
[Exclusivity] Temporarily disable an assert in AccessEnforcementSelector.
...
This pass doesn't do anything useful downstream yet, so it's safe to temporarily
disable the assert.
Reenable after fixing:
<rdar://problem/31797132> [Exclusivity] lldb asserts in AccessEnforcementSelector
2017-04-24 14:46:41 -07:00
Slava Pestov
0290c2d5d8
AST: Make GenericSignature and GenericEnvironment SubstitutionMaps interchangable
...
SubstitutionMap::lookupConformance() would map archetypes out
of context to compute a conformance path. Do the same thing
in SubstitutionMap::lookupSubstitution().
The DenseMap of replacement types in a SubstitutionMap now
always has GenericTypeParamTypes as keys.
This simplifies some code and brings us one step closer to
a more efficient representation of SubstitutionMaps.
2017-04-24 14:12:36 -07:00
Roman Levenstein
53745e61cf
Merge pull request #8961 from swiftix/open-archtypes-tracker-fixes
...
[sil-opened-archetype-tracker] Improve tracking of archetypes in SILBuilder
2017-04-24 13:52:51 -07:00
Saleem Abdulrasool
7e64abd48d
SILOptimizer: IWYU CommandLine.h (NFC)
2017-04-24 13:46:47 -07:00
Huon Wilson
d08d0ffdb8
Merge pull request #8845 from huonw/private-func-sig-specializations
...
[SILOpt] Specialized functions are never public.
2017-04-24 10:41:41 -07:00
Roman Levenstein
202de40f05
[sil-opened-archetype-tracker] Improve tracking of archetypes in SILBuilder
...
Fixes rdar://problem/31749245
2017-04-24 08:50:55 -07:00
Andrew Trick
48ecd6d563
[Exclusivity] Enable SILGen access marker emission by default.
...
This has no measurable effect on benchmarks and does not affect
standard library compile time.
2017-04-24 08:32:15 -07:00
Devin Coughlin
9cdff5fe00
[Exclusivity] Improve static enforcement diagnostics
...
Static diagnostics now refer to the identifier for the variable requiring
exclusive diagnostics. Additionally, when two accesses conflict we now always
emit the main diagnostic on the first modifying access and the note on either
the second modifying access or the read.
The diagnostics also now highlight the source range for the expression
beginning the access.
2017-04-23 11:39:25 -07:00
Arnold Schwaighofer
304b6c9a0e
Merge pull request #8943 from aschwaighofer/loop_unroller_sge_bound
...
LoopUnroller: Teach the loop unroller about >= terminated loops
2017-04-23 05:35:52 -07:00
Slava Pestov
397d059aaa
SILOptimizer: Fix some warnings in recent partial specialization changes
2017-04-23 02:16:07 -07:00
Slava Pestov
c14a4be04b
SILOptimizer: Don't attempt closure specialization if the callee uses dynamic Self
...
Currently, closure specialization inserts arguments after the 'self'
parameter, which breaks dynamic Self.
Fixes <rdar://problem/31725007>.
2017-04-23 01:49:00 -07:00
John McCall
7b7f23ab33
Merge pull request #8945 from rjmccall/unpaired-accesses
...
Add unpaired access marker instructions for materializeForSet
2017-04-23 04:35:00 -04:00
Roman Levenstein
a60e037c48
Revert "[sil-opened-archetype-tracker] Improve tracking of archetypes in SILBuilder"
2017-04-22 20:41:31 -07:00
Arnold Schwaighofer
cafe58251e
LoopUnroller: Also handle > exit condition
2017-04-22 20:04:13 -07:00
John McCall
978f0e05fe
Add unpaired access marker instructions and use them to implement
...
dynamic access tracking in materializeForSet.
2017-04-22 22:52:13 -04:00
Arnold Schwaighofer
533044d4c4
LoopUnroller: Teach the loop unroller about >= terminated loops
2017-04-22 17:32:37 -07:00
Roman Levenstein
33c8bde859
[sil-opened-archetype-tracker] Improve tracking of archetypes in SILBuilder
...
Fixes rdar://problem/31749245
2017-04-22 10:03:37 -07:00
Roman Levenstein
17597f73a8
Merge pull request #8880 from swiftix/partial-specialization
...
[generic-specializer] Final parts of the partial specialization implementation
2017-04-21 19:15:12 -07:00