Skip to content

Fix build issues after merging master #1162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 165 commits into from
Jun 5, 2020
Merged

Conversation

MaxDesiatov
Copy link

The corresponding fix is tracked upstream in apple#32201.

meg-gupta and others added 30 commits May 11, 2020 19:43
The PassManager should transform all functions in bottom up order.
This is necessary because when optimizations like inlining looks at the
callee function bodies to compute profitability, the callee functions
should have already undergone optimizations to get better profitability
estimates.

The PassManager builds its function worklist based on bottom up order
on initialization. However, newly created SILFunctions due to
specialization etc, are simply appended to the function worklist. This
can cause us to make bad inlining decisions due to inaccurate
profitability estimates. This change now updates the function worklist such
that, all the callees of the newly added SILFunction are proccessed
before it by the PassManager.

Fixes rdar://52202680
State explicitly that we want to eliminate all differences between
`apple/master` and `llvm.org/master`. All new LLVM development should happen
upstream.
… init

Diagnose an attempt to initialize raw representable type or convert to it
a value of some other type that matches its `RawValue` type.

```swift
enum E : Int {
   case a, b, c
}

let _: E = 0
```

`0` has to be wrapped into `E(rawValue: 0)` and either defaulted via `??` or
force unwrapped to constitute a valid binding.
…table`

Do the verification during constraint repair and provide fix itself
with raw representative type and its raw value to be used for diagnostics.
Clang provides options to override that default value.
These options are accessible via the -Xcc flag.

Some Swift functions explicitly disable the frame pointer.

The clang options will not override those.
…alization

This makes logic in `ContextualFailure::tryRawRepresentableFixIts`
partially obsolete.
…struction

Since both raw representable and value types originated in
constraint system they can have type variables which need to be
resolved before types could be used in a diagnostic and fix-it.
Add additional clarification that submitting to `swift/master-next` continues to be allowed.
…ontruct raw representable

Introduce `repairByExplicitRawRepresentativeUse` which is used for
assignment, argument-to-parameter conversions and contextual mismatches.

It checks whether `to` side is a raw representable type and tries
to match `from` side to its `rawValue`.
…instead of its raw value

Diagnose an attempt to pass raw representable type where its raw value
is expected instead.

```swift
enum E : Int {
  case one = 1
}

let _: Int = E.one
```

`E.one` has to use `.rawValue` to match `Int` expected by pattern binding.
to 'typeCheckAbstractFunctionBodyNodeAt()' because that only typecheck
a statement at the position.
…e initializers.

The Original Bug
----------------

In ffbfcfa, we fixed a bug around implicit
value initializers but did not cherry-pick it to 5.3. While investigating a bug
that turned out to be that same bug (no worries!), I noticed that there is
additional code that is "unsafely" correct in this area and that while
ffbfcfa is correct in the small, we can expand
on the fix to prevent future bugs.

The Larger Bug
--------------

Here we are still open coding using ManagedValue/Cleanup APIs /without/ a top
level function scope. The code is only correct since we never emit unconditional
cleanups and always manually forward conditional cleanups. If we did not do
either of these things, we would have another instance of this bug, namely a
cleanup that is never actually emitted. So the code on master today is correct,
albeit unsafe, and we already have coverage for this (namely the test case from
ffbfcfa).

That being said, in general when working with ManagedValue APIs (especially in
utility functions) we assume that we have a scope already created for us by our
caller. So by fixing this issue we are standardizing to safer SILGen invariants.

Building on ffbfcfa
----------------------------------------------------

This commit builds on the shoulders of ffbfcfa
by adding the function level scope mentioned in the previous section so that we
are now "safely" correct.

While looking at this I also realized that just using a normal scope when open
coding here may be a bit bugprone for open coding situations like this since:

1. If one just creates a scope in open coding situations, the scope will fire at
   end of the c++ function /after/ one has probably emitted a return.

2. Once one has emitted the return, the insertion point will no longer be set
   implying =><=.

To avoid this, I created a move only composition type on top of Scope called
AssertingManualScope. This type just asserts in its destructor if the scope it
contains has not been popped yet.

While, one can pop it by ones self, I added an overload of createReturnInst on
SILGenBuilder that also takes an AssertingManualScope and pops it at the
appropriate time.

So now when performing simple open coding tasks, we have the ability to in code
tie together the function level scope to the actual creation of return inst,
simulating the hand-off of lifetimes/resources from caller/callee that often
happens in the epilog of functions.

<rdar://problem/63189210>
Rather than trying to continue the compilation
with an empty main module, let's bail out early if
we expect an implicit stdlib import and fail to
load in the stdlib.
This part of a series of patches to bring ASTPrinter and Swift Demangler to
feature parity, which is needed by LLDB, which depends on using the strings
produced by either interchangibly.

<rdar://problem/63700540>
This part of a series of patches to bring ASTPrinter and Swift Demangler to
feature parity, which is needed by LLDB, which depends on using the strings
produced by either interchangibly.

rdar://problem/63700540
This is analogous to ASTPrinter's FullyQualifiedTypesIfAmbiguous option.

This part of a series of patches to bring ASTPrinter and Swift Demangler to
feature parity, which is needed by LLDB, which depends on using the strings
produced by either interchangibly.

rdar://problem/63700540
This part of a series of patches to bring ASTPrinter and Swift Demangler to
feature parity, which is needed by LLDB, which depends on using the strings
produced by either interchangibly.

rdar://problem/63700540
jckarter and others added 24 commits June 4, 2020 09:18
…wiftlang#32133)

* Add note that LLDB changes should be cherry-picked to `swift/master`

* New Swift-dependent commits should go to `swift/master`, not `swift/master-next`.

* Update naming scheme for release branches

* Fix indentation
…closure-cleanup

[AST] Clean up handling of single-expression closures
…8390-inherit-availability

[SymbolGraph] Inherit availability from parent contexts
ABI: qualify use of `StringRef` and `Optional` (NFC)
[NFC] AST: Optimize GenericSignatureImpl::getInnermostGenericParams
…03c93f1ba6ac111c52d1157

[semantic-arc-opts] Teach semantic-arc-opts how to handle structs with multiple non-trivial values.
[CSGen] Allow `is` patterns to infer type from enclosing context
runtime: silence -Wunused-variable warning (NFC)
…c54f4b3c46468e4706e7c80

[memory-lifetime] Teach the verifier that select_enum_addr doesn't write to memory.
…deScalarProperties

Refactors internal func _applyMapping using _FixedArray16
…iables

[Runtime] Unify debug variable parsing from the environment and avoid getenv when possible.
build: use the same pattern for detecting Darwin platforms
Inline the standard headers that they included and remove the extra
include path.
Cache empty member list so that 'IterableDeclContext::loadAllMembers()'
doesn't perform delayed member parsing.

Fixes: rdar://problem/63921896
…declbraces-rdar63921896

[Parse] Avoid delayed member parsing for type decl with missing brace
runtime: remove `llvm/DataTypes.h`, `llvm-c/DataTypes.h`
…ype-of-opaque-type

ASTDemangler: Add support for member types of opaque result types
…ssion-tests

A couple of regression tests
@MaxDesiatov MaxDesiatov marked this pull request as ready for review June 5, 2020 12:38
@MaxDesiatov MaxDesiatov merged commit 16d3b33 into swiftwasm Jun 5, 2020
@MaxDesiatov MaxDesiatov deleted the maxd/master-merge branch June 5, 2020 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.