Commit Graph

2543 Commits

Author SHA1 Message Date
Joe Groff
c374763632 SILGen: Fix override handling when a dynamic init is also required.
A missed case from #11107. Fixes SR-5542 | rdar://problem/33490780.
2017-07-25 10:24:19 -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
swift-ci
d78b7a369e Merge remote-tracking branch 'origin/master' into master-next 2017-07-19 14:29:10 -07:00
swift-ci
d9f0e3cedb Merge remote-tracking branch 'origin/master' into master-next 2017-07-19 13:28:52 -07:00
Arnold Schwaighofer
ebf7230224 Add comment that with semantic SIL we can go back to ignoring the read 2017-07-19 13:27:11 -07:00
Arnold Schwaighofer
e1140ca98a SIL: Fix unconditional checked cast's memory behavior
The instruction reads memory (the type).

rdar://32990161
2017-07-19 11:09:20 -07:00
swift-ci
30a7bd1844 Merge remote-tracking branch 'origin/master' into master-next 2017-07-19 01:28:52 -07:00
Slava Pestov
fb9d410350 AST: Rename UnqualifiedLookupResult => LookupResultEntry
There's a similar LookupResult::Result type in Sema, and I'd like
to combine the two.
2017-07-18 22:09:02 -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
1feb48c12e Merge remote-tracking branch 'origin/master' into master-next 2017-07-18 10:48:51 -07:00
Andrew Trick
b48b3b02e1 [sil-opaque-values] Add support for createLoadBorrow. 2017-07-18 09:02:43 -07:00
swift-ci
7063af3307 Merge remote-tracking branch 'origin/master' into master-next 2017-07-18 00:28:52 -07:00
Andrew Trick
4db2a46cff Add SIL instruction: open_existential_box_value.
This has the same semantics as open_existential_box, but returns an object value
instead of an address.

This is used in SIL opaque values mode. Attempting to reuse open_existential_box
in this mode causes SIL type inconsistencies that are too difficult to work
around. Adding this instruction allows for consistent handling of opaque values.

The original versions of several of these currently redundant instructions will
be removed once the SIL representation stabilizes.
2017-07-17 23:46:41 -07:00
Andrew Trick
f657ad2d3a Rename *ExistentialOpaque instructions to *ExistentialValue.
These instructions have the same semantics as the *ExistentialAddr instructions
but operate directly on the existential value, not its address.

This is in preparation for adding ExistentialBoxValue instructions.
The previous name would cause impossible confusion with "opaque existentials"
and "opaque existential boxes".
2017-07-17 23:46:41 -07:00
swift-ci
9447a6280b Merge remote-tracking branch 'origin/master' into master-next 2017-07-17 12:08:51 -07:00
Jordan Rose
e7ec1dbea3 Move SILGlobalVariable::dump out of line.
...so that it doesn't get emitted into every TU that imports the header.
2017-07-17 12:18:41 -06:00
swift-ci
ce9563f309 Merge remote-tracking branch 'origin/master' into master-next 2017-07-13 17:08:48 -07:00
swift-ci
88aa00e7de Merge pull request #10944 from gottesmm/some_convenience_apis 2017-07-13 17:04:57 -07:00
Michael Gottesman
a36a4ec738 [sil] Add convenience APIs: createTrivial{Load,Store}Or to SILBuilder.
Often times one wants to create a load/store and you don't know if you have a
trivial type. These APIs allow you to use the correct semantic ownership
qualifier at the callsite without worrying: if you have a true trivial type, the
API will change the qualifier to trivial for you.
2017-07-13 14:23:49 -07:00
Michael Gottesman
38cd78024b Add template <T> ValueBase::getSingleUserOfType.
Looping over all users and returning the only user of a specific type is a
common pattern in the compiler. This method just allows for the loop to be
eliminated.
2017-07-13 14:22:42 -07:00
swift-ci
f70e32cf19 Merge remote-tracking branch 'origin/master' into master-next 2017-07-12 18:08:55 -07:00
swift-ci
5bd97c500b Merge pull request #10923 from gottesmm/small_is_lowering_of_value_metatype_changes 2017-07-12 18:03:37 -07:00
Michael Gottesman
90289277e8 [sil] Add assert to SILBuilder::createValueMetatype to ensure that its type is a lowered type of our expected formal instanceType.
It makes it easier to track down this type of bug since the assert occurs in
SILBuilder right where the invalid ValueMetatype is created.

rdar://problem/31880847
2017-07-12 17:32:00 -07:00
Michael Gottesman
f2c4aeac31 [sil] Refactor isLoweringOf from the verifier onto SILType.
I am going to use this to put an assertion in SILBuilder on ValueMetatype so
that the assertion fires right when the ValueMetatype is created instead of
later once we are verifying. It is still only being used in assertions/etc.

rdar://problem/31880847
2017-07-12 17:31:59 -07:00
swift-ci
c33d8667ae Merge remote-tracking branch 'origin/master' into master-next 2017-07-11 12:49:08 -07:00
swift-ci
e98182387b Merge remote-tracking branch 'origin/master' into master-next 2017-07-11 12:23:35 -07:00
John McCall
7f22faf968 Substantially rework how SILGen handles bridging as part of laying the
ground work for the syntactic bridging peephole.

- Pass source and dest formal types to the bridging routines in addition
  to the dest lowered type.  The dest lowered type is still necessary
  in order to handle non-standard abstraction patterns for the dest type.

- Change bridging abstraction patterns to store bridged formal types
  instead of the formal type.

- Improve how SIL type lowering deals with import-as-member patterns.

- Fix some AST bugs where inadequate information was being stored in
  various expressions.

- Introduce the idea of a converting SGFContext and use it to regularize
  the existing id-as-Any conversion peephole.

- Improve various places in SILGen to emit directly into contexts.
2017-07-11 12:45:13 -04:00
Michael Gottesman
1264cfa492 [semantic-sil] Add a semantic attribute "verify.ownership.sil.never".
This semantic attribute allows a user to disable ownership verification on
specific functions.

The intention is that once I turn on the sil ownership verifier for parts of the
stdlib, if an engineer exposes an ownership issue, they can disable ownership
verification on that specific function, file a bug, and continue with their
work.

rdar://31880847
2017-07-10 13:28:06 -07:00
Joe Groff
8793212293 Merge pull request #10741 from jckarter/key-path-generic-computed
Handle generic computed properties in key paths.
2017-07-07 13:50:27 -07:00
Joe Groff
101788dbd4 IRGen: Support for computed properties with dependent generic context.
Use the KeyPath implementation's new support for instantiating and dealing with captures to lower the generic context required to dispatch computed accessors with dependent generics.
2017-07-06 20:07:41 -07:00
swift-ci
cce4d1e960 Merge remote-tracking branch 'origin/master' into master-next 2017-07-06 11:28:50 -07:00
Robert Widmann
957d633185 Rename getInOutOrLValueObjectType to getWithoutSpecifierType
Prepares the AST for a future in which more than just inout and
@lvalue need to be stripped off of ephemeral types.
2017-07-06 09:35:04 -07:00
Bob Wilson
b9f6e6b371 Remove llvm::DominatorBase templates to match LLVM r306713.
The content from DominatorBase has been merged into DominatorTreeBase,
and DominatorBase has been removed.
2017-07-05 11:56:00 -07:00
Michael Gottesman
78713ce07f Merge pull request #10519 from jrose-apple/ModuleMacro-master-next
WIP getting master-next up and running with clang::ModuleMacro
2017-06-30 14:52:09 -07:00
swift-ci
b28a1093da Merge remote-tracking branch 'origin/master' into master-next 2017-06-29 15:09:18 -07:00
Doug Gregor
623d72db3c [AST] Make the "requirement signature" of a protocol a flat array.
Rather than pretend that the requirement signature of a protocol is a
full, well-formed generic signature that one can meaningfully query,
treat it as a flat set of requirements. Nearly all clients already did
this, but make it official. NFC
2017-06-29 14:01:49 -07:00
Greg Parker
7b009eccde Merge remote-tracking branch 'origin/master' into master-next 2017-06-28 15:25:17 -07:00
Joe Groff
3c82e981f9 KeyPaths: Add support for optional chaining/forcing components.
rdar://problem/31768715
2017-06-26 09:40:31 -07:00
Jordan Rose
c22168d02d [SIL] Implement a very simple isLegalToHoistInto for llvm::LoopInfo.
I'm not a SIL author, so it's likely that this could be improved,
but I think this is closest to the old LLVM behavior.
2017-06-23 12:49:49 -07:00
Huon Wilson
d49d3e9337 Merge pull request #10394 from huonw/symbol-list-9
[AST] Move getEffectiveAccess calls into SIL.
2017-06-22 10:38:17 -07:00
Andrew Trick
e51bc3beca Add a comment in getCalleeArgIndexOfFirstAppliedArg(). 2017-06-21 19:39:12 -07:00
Huon Wilson
a0bc3bd0b6 [AST] Move getEffectiveAccess calls into SIL. 2017-06-20 17:34:48 -07:00
Andrew Trick
e27bdf706e Add utilities to ApplySite to avoid hardcoding parameter/argument offsets. 2017-06-20 00:01:52 -07:00
Huon Wilson
296f23189b [TBDGen] Protocol witnesses thunks for members of public superprotocols are public.
Specifically, public superprotocols of non-public protocols have some
weird handling in SILGen, so we reproduce this.

Fixes rdar://problem/32254485 .
2017-06-19 15:00:12 -07:00
Roman Levenstein
2a10d8692b Clean-up the code that stored and passes the SILSerializeAll flag around.
- SILSerializeAll flag is now stored in the SILOptions and passed around as part of it
- Explicit SILSerializeAll/wholeModuleSerialized/makeModuleFragile API parameters are removed in many places
2017-06-16 17:50:33 -07:00
swift-ci
22bc57287e Merge remote-tracking branch 'origin/master' into master-next 2017-06-08 10:08:35 -07:00
Roman Levenstein
647466d0b0 [sil-opened-archetype-tracker] Fix a memory leak
Placeholder global_addr instructions were never destroyed.
Now they are inserted in the entry basic block and later removed from there by the end of SIL deserialization.
2017-06-08 07:50:57 -07:00
swift-ci
2f46f4574f Merge remote-tracking branch 'origin/master' into master-next 2017-06-07 17:28:34 -07:00
Michael Gottesman
f85da6860a [sil] Delete SILInstruction::removeFromParent().
This is a very easily misused API since it allows for users to leak instructions
if they are not careful. This commit removes this API and replaces the small
number of uses of this API with higher level APIs that accomplish the same task
without using removeFromParent(). There were no API users that specifically
required removeFromParent.

An example of one way we were using removeFromParent is to move a SILInstruction
to the front of a block. That does not require exposing an API like
removeFromParent()... we can just create a higher level API like the one added
in this commit: SILInstruction::moveFront(SILBasicBlock *).

rdar://31276565
2017-06-07 16:52:10 -07:00