Commit Graph

1051 Commits

Author SHA1 Message Date
swift-ci
b87673dc82 Merge remote-tracking branch 'origin/master' into master-next 2018-04-27 00:29:08 -07:00
Slava Pestov
175b40919f AST: Fewer headers include Expr.h, Module.h, Stmt.h 2018-04-26 22:55:26 -07:00
Michael Gottesman
afc98b34e9 [func-sig-opts] Add a new mangling for the guaranteed->owned transformation.
I followed the example of the owned->guaranteed transformation.

rdar://38196046
2018-04-26 16:36:41 -07:00
swift-ci
31c62d1a52 Merge remote-tracking branch 'origin/master' into master-next 2018-04-25 19:29:17 -07:00
Michael Gottesman
1fdb6ca4ab [func-sig-opts] Make FunctionSignatureOptUtils a library specific header and merge some of it into FunctionSignatureOpts.
This functionality is really specific to FunctionSignatureOpts. It really
doesn't make sense to have it as a utils until it becomes more general or we
need it in multiple places.

NFC.

rdar://38196046
2018-04-25 18:10:30 -07:00
swift-ci
0d3f087c3c Merge remote-tracking branch 'origin/master' into master-next 2018-04-17 06:49:06 -07:00
Andrew Trick
cdcb7c7a2c [NFC] SideEffectAnalysis refactoring and cleanup.
Make this a generic analysis so that it can be used to analyze any
kind of function effect.

FunctionSideEffect becomes a trivial specialization of the analysis.

The immediate need for this is to introduce an new
AccessedStorageAnalysis, although I foresee it as a generally very
useful utility. This way, new kinds of function effects can be
computed without adding any complexity or compile time to
FunctionSideEffects. We have the flexibility of computing different
kinds of function effects at different points in the pipeline.

In the case of AccessedStorageAnalysis, it will compute both
FunctionSideEffects and FunctionAccessedStorage in the same pass by
implementing a simple wrapper on top of FunctionEffects.

This cleanup reflects my feeling that nested classes make the code
extremely unreadable unless they are very small and either private or
only used directly via its parent class. It's easier to see how these
classes compose with a flat type system.

In addition to enabling new kinds of function effects analyses, I
think this makes the implementation of side effect analysis easier to
understand by separating concerns.
2018-04-16 17:05:04 -07:00
swift-ci
491445b075 Merge remote-tracking branch 'origin/master' into master-next 2018-04-12 11:35:46 -07:00
Davide Italiano
b4d563802b [SILInstruction] Introduce isDebugInstruction().
This is a property of an instruction and should be a member
function of `SILInstruction` and not a free function in
`DebugUtils`. Discussed with Adrian.
2018-04-11 10:14:21 -07:00
swift-ci
272cac3586 Merge remote-tracking branch 'origin/master' into master-next 2018-04-07 20:29:42 -07:00
Michael Gottesman
88bc490380 [func-sig-opts] hasNonTrivialNonDebugUse => hasNonTrivialNonDebugTransitiveUsers and move to DebugUtils.
I am getting rid of FunctionSignatureOptUtils. It is only used by
FunctionSignatureOpts, so it should either be a local utility file whose header
lives in ./lib or integrated into FunctionSignatureOpts. Beyond this utility
function (which seems like a generally useful thing that should be in
DebugUtils), the only other thing left in FunctionSignatureOptUtils is part of
the heuristic of FunctionSignatureOpts. It should really be in that file.

rdar://38196046
2018-04-07 10:06:48 -07:00
swift-ci
6c2f4dd034 Merge remote-tracking branch 'origin/master' into master-next 2018-03-30 23:08:53 -07:00
Slava Pestov
e1f50b2d36 SE-0193: Rename @_inlineable to @inlinable, @_versioned to @usableFromInline 2018-03-30 21:55:30 -07:00
swift-ci
53cb21bb8a Merge remote-tracking branch 'origin/master' into master-next 2018-03-30 20:49:03 -07:00
Michael Gottesman
a00f252ff8 Merge pull request #15646 from gottesmm/pr-3a87b9bc7f815f7952b698d3f63f36dd1fb9bbde
[generic-specializer] Promote non-trivial in_guaranteed => guaranteed.
2018-03-30 20:44:30 -07:00
Michael Gottesman
510381e8ec [generic-specializer] Promote non-trivial in_guaranteed => guaranteed.
We did this for @in => @owned for all parameters before enabling +0. We decided
to defer this work to after +0 was turned back on.

This also fixes the array_contentof_opt test without making append(contentOf: )
take the container at +1.

rdar://38152291
2018-03-30 18:20:35 -07:00
swift-ci
926815f2c1 Merge remote-tracking branch 'origin/master' into master-next 2018-03-29 23:28:57 -07:00
Davide Italiano
4bfab82eda [MandatoryInlining] Set the correct debug scope when creating a strong_release.
<rdar://problem/39022477>
2018-03-29 21:07:48 -07:00
swift-ci
e6d70f352e Merge remote-tracking branch 'origin/master' into master-next 2018-03-27 22:08:57 -07:00
Huon Wilson
c08085f359 [SILOptimizer] Don't optimize casts to protocols with a conditional conformance.
The conformance existing isn't enough to be sure the cast will succeed,
there may be dynamic information, so we just assume they're always
dynamic and always "MaySucceed".

Fixes rdar://problem/38694450.
2018-03-28 14:58:13 +11:00
swift-ci
1d564a640c Merge remote-tracking branch 'origin/master' into master-next 2018-03-26 14:08:37 -07:00
Joe Shajrawi
98ef683ad3 Merge pull request #15517 from shajrawi/expand_all
[SILOptimizer] shouldExpand can't expand address only types
2018-03-26 14:01:12 -07:00
swift-ci
104921675d Merge remote-tracking branch 'origin/master' into master-next 2018-03-26 12:58:42 -07:00
Joe Shajrawi
e0d94d6956 [SILOptimizer] shouldExpand can't expand address only types: fix a bug wherein EnableExpandAll overrode that 2018-03-26 11:11:50 -07:00
swift-ci
e5ee8f31bb Merge remote-tracking branch 'origin/master' into master-next 2018-03-26 11:03:48 -07:00
Michael Gottesman
86bdc0c0a9 [local] Convert llvm::none_of negative condition => llvm::all_of positive condition.
Outside of the actual function in question this is NFC.
2018-03-26 10:46:17 -07:00
Michael Gottesman
9001d1029f [local] Change some for-loops in analyzeStaticInitializer to use llvm::none_of.
Noticed this while trying to understand the code in global opt that uses this. I
also did a little style cleanup in the function.

NFC.
2018-03-24 14:58:20 -07:00
swift-ci
d9d63fd702 Merge remote-tracking branch 'origin/master' into master-next 2018-03-19 23:07:30 -07:00
Michael Gottesman
e567bc9028 [+0-all-args] Enable +0 normal arguments.
rdar://34222540
2018-03-19 20:25:31 -07:00
swift-ci
7fb186fece Merge remote-tracking branch 'origin/master' into master-next 2018-03-11 23:29:00 -07:00
Andrew Trick
9703d56e03 [exclusivity] Remove dead access markers after optimization.
Generalized to handle scope markers which will become common with future
ownership and lifetime dependence markers.
2018-03-11 23:13:30 -07:00
swift-ci
ecd7a48bb2 Merge remote-tracking branch 'origin/master' into master-next 2018-03-09 09:49:07 -08:00
Arnold Schwaighofer
1e4f55de8d Merge pull request #15046 from aschwaighofer/without_actually_escaping_verification
Implement withoutActuallyEscaping verification
2018-03-09 09:34:06 -08:00
swift-ci
52a9d71e70 Merge remote-tracking branch 'origin/master' into master-next 2018-03-08 01:49:10 -08:00
Sho Ikeda
cea6c03eb2 [gardening] Use !empty() over size() > 0 2018-03-08 09:21:09 +09:00
Arnold Schwaighofer
5940796cc1 SIL: Add an is_escaping_closure instruction
Will be used to verify that withoutActuallyEscaping's block does not
escape the closure.

``%escaping = is_escaping_closure %closure`` tests the reference count. If the
closure is not uniquely referenced it prints out and error message and
returns true. Otherwise, it returns false. The returned result can be
used with a ``cond_fail %escaping`` instruction to abort the program.

rdar://35525730
2018-03-07 08:56:00 -08:00
swift-ci
938927f04b Merge remote-tracking branch 'origin/master' into master-next 2018-03-05 12:09:02 -08:00
Arnold Schwaighofer
390ba419fc Add an effects(releasenone) function effects attribute
A ``@effects(releasenone)`` function might read/write global state but does not
perform a release.
2018-03-05 07:03:54 -08:00
swift-ci
1e8c4087e8 Merge remote-tracking branch 'origin/master' into master-next 2018-03-01 13:50:50 -08:00
Michael Gottesman
7dc017cc60 Teach the generic specializer how to convert @in_guaranteed parameters to @guaranteed parameters.
We already do this for @in parameters. I think it was just never implemented for
@in_guaranteed. The reason I am doing this now is that a bunch of test cases
that tested @in -> trivial. By doing this I get the @in_guaranteed -> trivial
implying those test cases do not need to be updated.

Important Note: We have bad test cases for resilience when dealing with generic specializer. Also add correct test cases + change existing ones

Note2: We only support this for trivial in_guaranteed types
2018-03-01 10:44:35 -08:00
swift-ci
25459d7aff Merge remote-tracking branch 'origin/master' into master-next 2018-02-26 15:48:53 -08:00
swift-ci
984dafe55b Merge pull request #14840 from shajrawi/concat_thin 2018-02-26 15:33:55 -08:00
Joe Shajrawi
2314df3db5 Handle 'thin' callees in extractStringConcatOperands 2018-02-26 14:35:48 -08:00
swift-ci
e6620914e1 Merge remote-tracking branch 'origin/master' into master-next 2018-02-21 13:17:22 -08:00
swift-ci
d468dcb108 Merge pull request #14767 from adrian-prantl/37720555 2018-02-21 13:10:45 -08:00
Adrian Prantl
9b6a9946ec Be explicit about whether a DebugInfo-carying SILInstruction has debug info.
This patch both makes debug variable information it optional on
alloc_stack and alloc_box instructions, and forced variable
information on debug_value and debug_value_addr instructions. The
change of the interface uncovered a plethora of bugs in SILGen,
SILTransform, and IRGen's LoadableByAddress pass.

Most importantly this fixes the previously commented part of the
DebugInfo/local-vars.swift.gyb testcase.

rdar://problem/37720555
2018-02-21 10:50:19 -08:00
swift-ci
68fd7acc8f Merge remote-tracking branch 'origin/master' into master-next 2018-02-20 08:09:54 -08:00
Joe Shajrawi
b0fdadb3d2 Devirtualizer: disable the “effectively final” optimization if a function is inlinable.
The devirtualizer performs two optimizations:

- If a value is known to have an exact class type, ie it is the result of an alloc_ref, we can devirtualize calls of *non-final* methods, because we know we’re calling that specific method and not an override.

- If a method is known to be “effectively final” (it is not open, and there are no overrides inside the module) we can devirtualize it.

However the second optimization needs to be disabled if a function is inlinable (F->getResilienceExpansion() == ResilienceExpansion::Minimal).
2018-02-20 16:06:01 +02:00
swift-ci
beae25974d Merge remote-tracking branch 'origin/master' into master-next 2018-02-14 05:29:28 -08:00
Arnold Schwaighofer
a9fa8c9c2b Merge pull request #14514 from aschwaighofer/wip_closure_capture_abi_part2
WIP: Closure ABI - Make @noescape Swift closures trivial
2018-02-14 05:19:25 -08:00