Commit Graph

2592 Commits

Author SHA1 Message Date
Slava Pestov
70b16e11f9 Fix the build due to a merge conflict 2017-09-07 14:06:38 -07:00
Arnold Schwaighofer
94a5e10dc2 Address review comments 2017-09-06 09:37:00 -07:00
Arnold Schwaighofer
b625d4da8a Osize: Add a SIL Outliner pass that outlines the bridging of objective c calls.
Implements outlining of bridged objective c property and method calls.

rdar://33387700
2017-09-06 08:37:37 -07:00
swift-ci
b765ab7f38 Merge pull request #11741 from shajrawi/revert_deepcopy 2017-09-05 17:31:47 -07:00
Michael Gottesman
e378ad8075 [copy-forwarding] Move a DEBUG log of an instruction to before we destroy the instruction...
Found while debugging dc8b1c2c3a.
2017-09-04 10:49:15 -07:00
Joe Shajrawi
829891b314 Revert "Use emitCopy/Destroy value instead of LoweredCopy/Destroy for large types"
This reverts commit fb1b2a8d9d.
2017-09-01 17:24:58 -07:00
Michael Gottesman
b2550ecb44 [ownership] Do not print out ownership convention on BBArgs once ownership is stripped.
rdar://31521023
2017-08-31 17:53:54 -07:00
Jordan Rose
f8b7db4e76 Excise the terms "blacklist" and "whitelist" from Swift source. (#11687)
The etymology of these terms isn't about race, but "black" = "blocked"
and "white" = "allowed" isn't really a good look these days. In most
cases we weren't using these terms particularly precisely anyway, so
the rephrasing is actually an improvement.
2017-08-30 09:28:00 -07:00
swift-ci
e952c3541b Merge pull request #11676 from shajrawi/explode_large_types_fix 2017-08-29 13:24:06 -07:00
Joe Shajrawi
fb1b2a8d9d Use emitCopy/Destroy value instead of LoweredCopy/Destroy for large types 2017-08-29 12:57:31 -07:00
Jordan Rose
1c651973c3 Excise "Accessibility" from the compiler (2/3)
"Accessibility" has a different meaning for app developers, so we've
already deliberately excised it from our diagnostics in favor of terms
like "access control" and "access level". Do the same in the compiler
now that we aren't constantly pulling things into the release branch.

This commit changes the 'Accessibility' enum to be named 'AccessLevel'.
2017-08-28 11:34:44 -07:00
Jordan Rose
5f30eac288 Excise "Accessibility" from the compiler (1/3)
"Accessibility" has a different meaning for app developers, so we've
already deliberately excised it from our diagnostics in favor of terms
like "access control" and "access level". Do the same in the compiler
now that we aren't constantly pulling things into the release branch.

This commit changes the names of methods, fields, a few local
variables, and even a swift-ide-test flag. The full list is below.

accessibilityForDiagnostics -> accessLevelForDiagnostics
checkAccessibility -> checkAccess
checkGenericParamAccessibility -> checkGenericParamAccess
checkTypeAccessibility -> checkTypeAccess
checkWitnessAccessibility -> checkWitnessAccessibility
computeAccessibility -> computeAccessLevel
computeDefaultAccessibility -> computeDefaultAccessLevel
fixItAccessibility -> fixItAccess
getAccessibilityString -> getAccessLevelString
getAccessibilityStrictly -> getAccessLevelStrictly
getAccessibilityUID -> getAccessLevelUID
getActualAccessibility -> getActualAccessLevel
getDefaultAccessibility -> getDefaultAccessLevel
getMaxAccessibility -> getMaxAccessLevel
getOverridableAccessibility -> getOverridableAccessLevel
getRawStableAccessibility -> getRawStableAccessLevel
getSetterAccessibility -> getSetterFormalAccess
hasAccessibility -> hasAccess
hasDefaultAccessibility -> hasDefaultAccessLevel
inferAccessibility -> inferAccessLevel
inferDefaultAccessibility -> inferDefaultAccessLevel
inferSetterAccessibility -> inferSetterAccessLevel
overwriteAccessibility -> overwriteAccess
overwriteSetterAccessibility -> overwriteSetterAccess
printAccessibility -> printAccess
requiredAccessibilityForDiagnostics -> requiredAccessForDiagnostics
resolveAccessibility -> resolveAccessControl
setAccessibility -> setAccess
setSetterAccessibility -> setSetterAccess
setDefaultAndMaxAccessibility -> setDefaultAndMaxAccess
validateAccessibility -> validateAccessControl

Accessibility -> AccessLevel
AccessibilityFilter -> AccessFilter
IgnoreAccessibility -> IgnoreAccessControl
NL_IgnoreAccessibility -> NL_IgnoreAccessControl
PrintAccessibility -> PrintAccess
PrintInternalAccessibilityKeyword -> PrintInternalAccessKeyword
SetterAccessibility -> SetterAccessLevel

setterAccessibility -> setterAccess
storedPropertyAccessibility -> storedPropertyAccess

-print-accessibility -> -print-access
2017-08-28 11:11:57 -07:00
Erik Eckstein
7d359cddfc SimplifyCFG: fix hang caused by infinite loop in CFG
fixes SR-5764, rdar://problem/34068905
2017-08-25 18:03:26 -07:00
Joe Shajrawi
8911d9a0fd Merge pull request #11520 from shajrawi/reduce_explosion
Reduce expansion of large types in the optimizer
2017-08-25 14:19:16 -07:00
Joe Shajrawi
570a82aea5 Reduce expansion of large types in the optimizer 2017-08-25 13:56:26 -07:00
Erik Eckstein
020a283bbb SIL: Let the OpenedArchetypesTracker be constructed with a null SILFunction.
NFC
2017-08-23 09:15:00 -07:00
Roman Levenstein
95223728c2 [sil-inliner] It is always OK to inline a simple call
A simple call is an invocation of a function without any side-effects, where all passed parameters are constants.
2017-08-22 15:16:19 -07:00
Arnold Schwaighofer
1b7a308016 Osize: Only skip inlining for class methods
This addresses most of the regressions from the compat suite and some size
saving gains.
2017-08-18 14:28:32 -07:00
Arnold Schwaighofer
d85b35b588 Tune down inlining at Osize
This is obviously just a start. Don't inline into thunks and don't inline
methods.

Start off with half the benefit for removing a call.
2017-08-17 14:57:22 -07:00
Arnold Schwaighofer
0abf3faa6b Disable function signature optimization at -Osize.
We might be more aggressive here in the future.
2017-08-17 14:57:22 -07:00
Arnold Schwaighofer
64f2d64b54 Disable SpeculativeDevirtualization at -Os 2017-08-17 14:57:22 -07:00
Erik Eckstein
88572a0844 SimplifyCFG: fix a bug which causes SimplifyCFG to hang.
This could happen for CFGs which contain an infinite loop through a switch_enum in the loop header.

rdar://problem/33762217
2017-08-10 17:30:54 -07:00
Erik Eckstein
6c93798acc SILOptimizer: Add a new TempRValue optimization pass
This is a separate optimization that detects short-lived temporaries that can be eliminated.
This is necessary now that SILGen no longer performs basic RValue forwarding in some cases.

SR-5508: Performance regression in benchmarks caused by removing SILGen peephole for LoadExpr in +0 context
2017-08-05 17:23:51 -07:00
swift-ci
e5b6bc1276 Merge remote-tracking branch 'origin/master' into master-next 2017-08-02 15:49:58 -07:00
Roman Levenstein
b83faa0109 [sil-devirtualizer] Fix a bug in devirtualization of methods that never return
This bug was caught by the SIL verifier. Any invocation of a NoReturn function should be followed by an `unreachable` instruction.

Fixes rdar://problem/33591235
2017-08-02 15:14:03 -07:00
swift-ci
0c1ec5f4ed Merge remote-tracking branch 'origin/master' into master-next 2017-08-01 16:48:57 -07:00
Roman Levenstein
5a22424607 [dead-store-elimination] Add support for handling stores to stack promoted objects
Essentially, treat `alloc_ref [stack]` allocated objects in the same way as we treat `alloc_stack` allocated objects.
2017-08-01 15:39:46 -07:00
swift-ci
0a5ee4200a Merge remote-tracking branch 'origin/master' into master-next 2017-07-24 12:48:50 -07:00
Erik Eckstein
6377cc095a SIL: Replace TransitivelyUnreachableBlocks with DeadEndBlocks
We had both utilities doing the same thing.
NFC
2017-07-24 09:50:42 -07:00
Bob Wilson
7ae35833de Merge remote-tracking branch 'origin/master' into master-next 2017-07-21 16:18:54 -07:00
Erik Eckstein
f59c1e4438 StackPromotion: a big simplification of the algorithm
Instead of having the complicated logic of finding the end of an object's lifetime we now use the existing ValueLifetimeAnalysis and StackNesting tools.
This simplifies the implementation a lot and does not use dominator and post-dominator trees anymore.

It's not a NFC because the way how to ensure proper nesting of stack allocations is now different.
To correct the stack nesting, the deallocations are moved down (instead of moving the allocations up).
Also it's now required that there is a final release for the allocation on all paths (which was not the case in some hand-written SIL tests).

Computation of dead-end blocks and escape analysis are now only done on demand. This saves compile time in case a function has no alloc_refs at all.
2017-07-21 13:24:58 -07:00
Erik Eckstein
a0e6082d25 SILOptimizer: change the way how ValueLifetimeAnalysis handles dead-end (unreachable) CFG paths.
In dead-array elimination we assume that the array allocation is post-dominated by all its final releases.
The only exception are branches to dead-end ("unreachable") blocks. So we just ignored all paths which didn't end up in a final release.
Now we explicitly pass the set of dead-end blocks and just ignore those blocks.
This is safer and it's also needed in the upcoming re-write of StackPromotion.
2017-07-21 10:46:03 -07:00
Bob Wilson
62c84a5461 [master-next] Update to work with recent dominator tree changes.
This patch started with a suggestion from Adrian Prantl to adapt to
LLVM r307953. The code has changed more since then so I modified it
to get it to build and I also fixed up StackPromotion to deal with related
changes. (I did not search back very far but it looks like the StackPromotion
change may have been a latent bug that did not matter much until recent
changes started using the function parameter.)
2017-07-19 22:52:21 -07:00
John McCall
4d3e44f98d Update SIL's dominance analysis for the template changes in LLVM.
StackPromotion is still busted.
2017-07-18 17:03:28 -04:00
swift-ci
b1384e5ca1 Merge remote-tracking branch 'origin/master' into master-next 2017-07-18 11:08:50 -07:00
Huon Wilson
994121e3d2 Merge pull request #10861 from huonw/symbol-list-10
TBD: includes all symbols from a full build and test
2017-07-18 10:54:17 -07:00
Huon Wilson
7d843f723c [SILOptimizer] A signature optimized function should have specialized linkage.
Previously this would mean that specialization of a public function are public,
which is incorrect.
2017-07-17 17:33:02 -07:00
Bob Wilson
2fb4f0cae0 master-next: move DEBUG_TYPE macro definition after #includes
LLVM r307950 added a definition of DEBUG_TYPE, followed by an #undef,
in the GenericDomTreeConstruction.h header.
2017-07-14 13:29:42 -07:00
Arnold Schwaighofer
e09abf1341 SimplifyCFG: JumpThread to facilitate ARC removal
It is beneficial to jump thread if we can remove a retain/release pair.

rdar://33099675
SR-5360
2017-07-11 13:43:57 -07:00
Erik Eckstein
c422461527 ArrayElementValuePropagation: Don’t create wrong SIL when trying to optimize ContiguousArray
Instead just bail on ContiguousArray.

https://bugs.swift.org/browse/SR-5293
rdar://problem/32983212
2017-06-28 11:36:39 -07:00
Erik Eckstein
8193b084e4 ARCCodeMotion: fix two problems in release hoisting:
1) PostOrderAnalysis is not invalidated after splitting critical edges. This let the data flow solver omit new inserted blocks.

2) Handle infinite loops in the CFG correctly. So that we don’t insert random release instructions into such CFG pathes.

https://bugs.swift.org/browse/SR-5187
rdar://problem/32713742
2017-06-23 15:20:09 -07:00
Devin Coughlin
2896d5b93f [SIL Utils] Move IndexTrieNode into its own header in Utils. NFC.
Move IndexTrieNode from DeadObjectElimination into its own header. I plan to
use this data structure when diagnosing static violations of exclusive access.
2017-06-14 21:23:14 -07:00
Erik Eckstein
26642ec419 SIL optimizer: Don’t crash if the user illegally lets an address of a local variable escape with withUnsafePointer
rdar://problem/32307046
2017-05-22 11:39:49 -07:00
Robert Widmann
3b202c18d8 Use 'hasAssociatedValues'
Use 'hasAssociatedValues' instead of computing and discarding the
interface type of an enum element decl.  This change has specifically not
been made in conditions that use the presence or absence of the
interface type, only conditions that depend on the presence or absence
of associated values in the enum element decl.
2017-05-22 09:54:47 -07:00
Roman Levenstein
980a590708 [sil-inliner] Transparent functions should be inlined by the performance inliner as if they are always inline functions 2017-05-19 15:08:25 -07:00
Roman Levenstein
341b5c506d [sil-inliner] Respect the @inline(__always) and @_transparent even if inlining of generics is disabled
If some functions are explicitly annotated by developers as @inline(__always) or @_transparent, they should always be a subject for the inlining of generics, even if this kind of inlining is not enabled currently for all functions.
2017-05-19 15:08:18 -07:00
Roman Levenstein
5b4691d901 Revert "[sil-inliner] Respect the @inline(__always) and @_transparent even if inlining of generics is disabled" 2017-05-19 08:20:55 -07:00
Roman Levenstein
116581f2c5 [sil-inliner] Transparent functions should be inlined by the performance inliner as if they are always inline functions 2017-05-18 21:54:45 -07:00
Roman Levenstein
3fcd6f40c8 [sil-inliner] Respect the @inline(__always) and @_transparent even if inlining of generics is disabled
If some functions are explicitly annotated by developers as @inline(__always) or @_transparent, they should always be a subject for the inlining of generics, even if this kind of inlining is not enabled currently for all functions.
2017-05-18 21:54:45 -07:00
Erik Eckstein
74fa0bcc87 Disable generic inlining and partial specialization, except in libswiftCore
This avoids code size regressions in programs while still getting the performance improvements in generic code in the stdlib.

rdar://problem/32277313
2017-05-18 15:38:54 -07:00