Skip to content

[embedded] Disallow use of VWTs for take/copy/assign/destroy operations, even under -Osize #68724

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 1 commit into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions lib/IRGen/Outlining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ static bool canUseValueWitnessForValueOp(IRGenModule &IGM, SILType T) {
if (!IGM.getSILModule().isTypeMetadataForLayoutAccessible(T))
return false;

// No value witness tables in embedded Swift.
if (IGM.Context.LangOpts.hasFeature(Feature::Embedded))
return false;

// It is not a good code size trade-off to instantiate a metatype for
// existentials, and also does not back-deploy gracefully in the case of
// constrained protocols.
Expand Down
2 changes: 2 additions & 0 deletions test/embedded/array-builtins-no-stdlib.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// RUN: %target-swift-emit-ir %s -parse-stdlib -module-name Swift -enable-experimental-feature Embedded -wmo -target arm64e-apple-none | %FileCheck %s
// RUN: %target-swift-emit-ir %s -parse-stdlib -module-name Swift -enable-experimental-feature Embedded -wmo -target arm64e-apple-none -Osize | %FileCheck %s
// RUN: %target-swift-emit-ir %s -parse-stdlib -module-name Swift -enable-experimental-feature Embedded -wmo -target arm64e-apple-none -O | %FileCheck %s

// REQUIRES: swift_in_compiler

Expand Down