Skip to content

[pull] swiftwasm from master #1434

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 33 commits into from
Jul 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b1ada5c
[FrontendTool] Add test for SPI imports in module trace.
varungandhi-apple Jul 9, 2020
7c36683
[FrontendTool] Include SPI dependencies in module trace.
varungandhi-apple Jul 7, 2020
cd3f46f
[AutoDiff] NFC: Garden assertions.
dan-zheng Jul 9, 2020
e3548dd
test: use `-log-path` for stderr access in ModuleInterface tests
compnerd Jul 9, 2020
061d651
test: make `remote-run` Python 3 friendly
compnerd Jul 9, 2020
cd744da
test: make test syntactically compatible with Python3
compnerd Jul 9, 2020
09f461b
[CodeCompletion] Safer getEquivalentDeclContextFromSourceFile()
rintaro Jul 10, 2020
5e36ae1
[sil] Add a forwarding cast called unchecked_value_cast.
gottesmm Jul 8, 2020
ac3109a
[eager-specializer] Fix for ownership and add a bunch of missing code…
gottesmm Jul 7, 2020
9a94dec
[metadata prespecialization] Reflect ptrauth in tests.
nate-chandler Jul 10, 2020
3e4ddb1
[NFC] Remove __swift_mode_t.
zoecarver Jul 7, 2020
13632d4
[cxx-interop] Mark types with a destructor a non-trivial.
zoecarver Jun 16, 2020
b9c43b4
[Test] Disabled Driver/linker.swift.
nate-chandler Jul 10, 2020
40a46e8
Merge pull request #32814 from nate-chandler/generic-metadata-prespec…
swift-ci Jul 10, 2020
2e1b6e7
Sema: KeyPath literals should be read-only when referring to unavaila…
jckarter Jul 8, 2020
85b549a
Sema: Synthesized setters get the availability of the decl they're sy…
jckarter Jul 9, 2020
5cd5a18
Merge pull request #32806 from rintaro/ide-completion-rdar61765124
rintaro Jul 10, 2020
eadd20a
Merge pull request #32746 from zoecarver/gardening/shims/swift-mode-t
swift-ci Jul 10, 2020
8cf6e93
Merge pull request #32402 from zoecarver/cxx/non-trival-with-destructor
swift-ci Jul 10, 2020
b4ef3da
Merge pull request #32818 from nate-chandler/rdar65281056
nate-chandler Jul 10, 2020
adec755
Merge pull request #32756 from gottesmm/eager_specializer_fix
gottesmm Jul 10, 2020
54baf04
Merge pull request #32794 from compnerd/debugging-the-debug-test
compnerd Jul 10, 2020
df830bc
[AutoDiff] NFC: Reimplement `VJPCloner` using pimpl pattern.
dan-zheng Jul 10, 2020
e72629d
Merge pull request #32771 from varungandhi-apple/vg-include-spi-deps-…
varungandhi-apple Jul 10, 2020
eb74f78
Sema: Force synthesis of the CodingKeys nested type in EmittedMembers…
slavapestov Jul 9, 2020
8f8639b
[AutoDiff] NFC: Reimplement `JVPCloner` using pimpl pattern.
dan-zheng Jul 10, 2020
39ad5e4
Merge pull request #32789 from compnerd/pipe-dream
CodaFi Jul 10, 2020
bf5698f
Merge pull request #32792 from compnerd/sprinting-to-the-end
compnerd Jul 10, 2020
88e17a6
Merge pull request #32819 from jckarter/keypath-writable-availability
jckarter Jul 10, 2020
246a657
[Text] Disable SILOptimizer/eager_specialize_ossa.sil on arm64e.
nate-chandler Jul 11, 2020
c647979
Merge pull request #32825 from dan-zheng/autodiff-gardening
dan-zheng Jul 11, 2020
b8b80b6
Merge pull request #32824 from slavapestov/fix-codingkeys-synthesis
slavapestov Jul 11, 2020
00b3473
Merge pull request #32833 from nate-chandler/rdar65373647
swift-ci Jul 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/SIL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5148,6 +5148,21 @@ unchecked_bitwise_cast
Bitwise copies an object of type ``A`` into a new object of type ``B``
of the same size or smaller.

unchecked_value_cast
````````````````````
::

sil-instruction ::= 'unchecked_value_cast' sil-operand 'to' sil-type

%1 = unchecked_value_cast %0 : $A to $B

Bitwise copies an object of type ``A`` into a new layout-compatible object of
type ``B`` of the same size.

This instruction is assumed to forward a fixed ownership (set upon its
construction) and lowers to 'unchecked_bitwise_cast' in non-ossa code. This
causes the cast to lose its guarantee of layout-compatibility.

ref_to_raw_pointer
``````````````````
::
Expand Down
19 changes: 18 additions & 1 deletion include/swift/SIL/SILBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,12 @@ class SILBuilder {
getSILDebugLocation(Loc), Op, Ty, getFunction(), C.OpenedArchetypes));
}

UncheckedValueCastInst *createUncheckedValueCast(SILLocation Loc, SILValue Op,
SILType Ty) {
return insert(UncheckedValueCastInst::create(
getSILDebugLocation(Loc), Op, Ty, getFunction(), C.OpenedArchetypes));
}

RefToBridgeObjectInst *createRefToBridgeObject(SILLocation Loc, SILValue Ref,
SILValue Bits) {
auto Ty = SILType::getBridgeObjectType(getASTContext());
Expand Down Expand Up @@ -1847,7 +1853,18 @@ class SILBuilder {
// Unchecked cast helpers
//===--------------------------------------------------------------------===//

// Create the appropriate cast instruction based on result type.
/// Create the appropriate cast instruction based on result type.
///
/// NOTE: We allow for non-layout compatible casts that shrink the underlying
/// type we are bit casting!
SingleValueInstruction *
createUncheckedReinterpretCast(SILLocation Loc, SILValue Op, SILType Ty);

/// Create an appropriate cast instruction based on result type.
///
/// NOTE: This assumes that the input and the result cast are layout
/// compatible. Reduces to createUncheckedReinterpretCast when ownership is
/// disabled.
SingleValueInstruction *createUncheckedBitCast(SILLocation Loc, SILValue Op,
SILType Ty);

Expand Down
10 changes: 10 additions & 0 deletions include/swift/SIL/SILCloner.h
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,16 @@ visitUncheckedBitwiseCastInst(UncheckedBitwiseCastInst *Inst) {
getOpType(Inst->getType())));
}

template <typename ImplClass>
void SILCloner<ImplClass>::visitUncheckedValueCastInst(
UncheckedValueCastInst *Inst) {
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
recordClonedInstruction(Inst, getBuilder().createUncheckedValueCast(
getOpLocation(Inst->getLoc()),
getOpValue(Inst->getOperand()),
getOpType(Inst->getType())));
}

template<typename ImplClass>
void
SILCloner<ImplClass>::
Expand Down
17 changes: 17 additions & 0 deletions include/swift/SIL/SILInstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -4576,6 +4576,23 @@ class UncheckedBitwiseCastInst final
SILFunction &F, SILOpenedArchetypesState &OpenedArchetypes);
};

/// Bitwise copy a value into another value of the same size.
class UncheckedValueCastInst final
: public UnaryInstructionWithTypeDependentOperandsBase<
SILInstructionKind::UncheckedValueCastInst, UncheckedValueCastInst,
OwnershipForwardingConversionInst> {
friend SILBuilder;

UncheckedValueCastInst(SILDebugLocation DebugLoc, SILValue Operand,
ArrayRef<SILValue> TypeDependentOperands, SILType Ty)
: UnaryInstructionWithTypeDependentOperandsBase(
DebugLoc, Operand, TypeDependentOperands, Ty,
Operand.getOwnershipKind()) {}
static UncheckedValueCastInst *
create(SILDebugLocation DebugLoc, SILValue Operand, SILType Ty,
SILFunction &F, SILOpenedArchetypesState &OpenedArchetypes);
};

/// Build a Builtin.BridgeObject from a heap object reference by bitwise-or-ing
/// in bits from a word.
class RefToBridgeObjectInst
Expand Down
2 changes: 2 additions & 0 deletions include/swift/SIL/SILNodes.def
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ ABSTRACT_VALUE_AND_INST(SingleValueInstruction, ValueBase, SILInstruction)
ConversionInst, None, DoesNotRelease)
SINGLE_VALUE_INST(UncheckedBitwiseCastInst, unchecked_bitwise_cast,
ConversionInst, None, DoesNotRelease)
SINGLE_VALUE_INST(UncheckedValueCastInst, unchecked_value_cast,
ConversionInst, None, DoesNotRelease)
SINGLE_VALUE_INST(RefToRawPointerInst, ref_to_raw_pointer,
ConversionInst, None, DoesNotRelease)
SINGLE_VALUE_INST(RawPointerToRefInst, raw_pointer_to_ref,
Expand Down
2 changes: 1 addition & 1 deletion include/swift/SILOptimizer/Differentiation/ADContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ ADContext::emitNondifferentiabilityError(SourceLoc loc,
return diagnose(loc, diag::autodiff_when_differentiating_function_call);
}
}
llvm_unreachable("invalid invoker");
llvm_unreachable("Invalid invoker kind"); // silences MSVC C4715
}

} // end namespace autodiff
Expand Down
Loading