Skip to content

Commit b8de883

Browse files
committed
Remove the -resilience-bypass flag and functionality.
LLDB no longer depends on it. rdar://problem/48018240
1 parent 7b654b3 commit b8de883

File tree

7 files changed

+13
-100
lines changed

7 files changed

+13
-100
lines changed

include/swift/AST/IRGenOptions.h

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ class IRGenOptions {
172172
/// expression evaluator.
173173
unsigned ForcePublicLinkage : 1;
174174

175-
/// Bypass resilience when accessing resilient frameworks.
176-
unsigned EnableResilienceBypass : 1;
177-
178175
/// Force lazy initialization of class metadata
179176
/// Used on Windows to avoid cross-module references.
180177
unsigned LazyInitializeClassMetadata : 1;
@@ -230,21 +227,20 @@ class IRGenOptions {
230227
Verify(true), OptMode(OptimizationMode::NotSet),
231228
Sanitizers(OptionSet<SanitizerKind>()),
232229
DebugInfoLevel(IRGenDebugInfoLevel::None),
233-
DebugInfoFormat(IRGenDebugInfoFormat::None),
234-
UseJIT(false), IntegratedREPL(false),
235-
DisableLLVMOptzns(false), DisableSwiftSpecificLLVMOptzns(false),
236-
DisableLLVMSLPVectorizer(false), DisableFPElim(true), Playground(false),
237-
EmitStackPromotionChecks(false), PrintInlineTree(false),
238-
EmbedMode(IRGenEmbedMode::None), HasValueNamesSetting(false),
239-
ValueNames(false), EnableReflectionMetadata(true),
240-
EnableReflectionNames(true), EnableAnonymousContextMangledNames(false),
241-
ForcePublicLinkage(false),
242-
EnableResilienceBypass(false), LazyInitializeClassMetadata(false),
230+
DebugInfoFormat(IRGenDebugInfoFormat::None), UseJIT(false),
231+
IntegratedREPL(false), DisableLLVMOptzns(false),
232+
DisableSwiftSpecificLLVMOptzns(false), DisableLLVMSLPVectorizer(false),
233+
DisableFPElim(true), Playground(false), EmitStackPromotionChecks(false),
234+
PrintInlineTree(false), EmbedMode(IRGenEmbedMode::None),
235+
HasValueNamesSetting(false), ValueNames(false),
236+
EnableReflectionMetadata(true), EnableReflectionNames(true),
237+
EnableAnonymousContextMangledNames(false), ForcePublicLinkage(false),
238+
LazyInitializeClassMetadata(false),
243239
LazyInitializeProtocolConformances(false), DisableLegacyTypeInfo(false),
244240
UseIncrementalLLVMCodeGen(true), UseSwiftCall(false),
245241
GenerateProfile(false), EnableDynamicReplacementChaining(false),
246-
DisableRoundTripDebugTypes(false),
247-
CmdArgs(), SanitizeCoverage(llvm::SanitizerCoverageOptions()),
242+
DisableRoundTripDebugTypes(false), CmdArgs(),
243+
SanitizeCoverage(llvm::SanitizerCoverageOptions()),
248244
TypeInfoFilter(TypeInfoDumpFilter::All) {}
249245

250246
// Get a hash of all options which influence the llvm compilation but are not

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,6 @@ def prebuilt_module_cache_path_EQ :
517517
Joined<["-"], "prebuilt-module-cache-path=">,
518518
Alias<prebuilt_module_cache_path>;
519519

520-
def enable_resilience_bypass : Flag<["-"], "enable-resilience-bypass">,
521-
HelpText<"Completely bypass resilience when accessing types in resilient frameworks">;
522-
523520
def force_public_linkage : Flag<["-"], "force-public-linkage">,
524521
HelpText<"Force public linkage for private symbols. Used by LLDB.">;
525522

lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,10 +1082,6 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
10821082
Opts.EnableReflectionNames = false;
10831083
}
10841084

1085-
if (Args.hasArg(OPT_enable_resilience_bypass)) {
1086-
Opts.EnableResilienceBypass = true;
1087-
}
1088-
10891085
if (Args.hasArg(OPT_force_public_linkage)) {
10901086
Opts.ForcePublicLinkage = true;
10911087
}

lib/IRGen/GenType.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,14 +1169,6 @@ static bool doesPlatformSupportObjCMetadataUpdateCallback(
11691169
TypeConverter::TypeConverter(IRGenModule &IGM)
11701170
: IGM(IGM),
11711171
FirstType(invalidTypeInfo()) {
1172-
// FIXME: In LLDB, everything is completely fragile, so that IRGen can query
1173-
// the size of resilient types. Of course this is not the right long term
1174-
// solution, because it won't work once the swiftmodule file is not in
1175-
// sync with the binary module. Once LLDB can calculate type layouts at
1176-
// runtime (using remote mirrors or some other mechanism), we can remove this.
1177-
if (IGM.IRGen.Opts.EnableResilienceBypass)
1178-
LoweringMode = Mode::CompletelyFragile;
1179-
11801172
const auto &Triple = IGM.Context.LangOpts.Target;
11811173

11821174
SupportsObjCMetadataUpdateCallback =

lib/IRGen/MetadataRequest.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -659,24 +659,6 @@ bool irgen::isTypeMetadataAccessTrivial(IRGenModule &IGM, CanType type) {
659659

660660
auto expansion = ResilienceExpansion::Maximal;
661661

662-
// Normally, if a value type is known to have a fixed layout to us, we will
663-
// have emitted fully initialized metadata for it, including a payload size
664-
// field for enum metadata for example, allowing the type metadata to be
665-
// used in other resilience domains without initialization.
666-
//
667-
// However, when -enable-resilience-bypass is on, we might be using a value
668-
// type from another module built with resilience enabled. In that case, the
669-
// type looks like it has fixed size to us, since we're bypassing resilience,
670-
// but the metadata still requires runtime initialization, so its incorrect
671-
// to reference it directly.
672-
//
673-
// While unconditionally using minimal expansion is correct, it is not as
674-
// efficient as it should be, so only do so if -enable-resilience-bypass is on.
675-
//
676-
// FIXME: All of this goes away once lldb supports resilience.
677-
if (IGM.IRGen.Opts.EnableResilienceBypass)
678-
expansion = ResilienceExpansion::Minimal;
679-
680662
// Resiliently-sized metadata access always requires an accessor.
681663
return (IGM.getTypeInfoForUnlowered(type).isFixedSize(expansion));
682664
}

test/DebugInfo/struct_resilience.swift

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66
// RUN: -emit-module-path=%t/resilient_struct.swiftmodule \
77
// RUN: -module-name=resilient_struct %S/../Inputs/resilient_struct.swift
88
//
9-
// RUN: %target-swift-frontend -g -I %t -emit-ir -enable-library-evolution %s -o - \
10-
// RUN: | %FileCheck %s
9+
// RUN: %target-swift-frontend -g -I %t -emit-ir -enable-library-evolution %s \
10+
// RUN: -o - | %FileCheck %s
1111
//
12-
// RUN: %target-swift-frontend -g -I %t -emit-ir -enable-library-evolution %s -o - \
13-
// RUN: -enable-resilience-bypass | %FileCheck %s --check-prefix=CHECK-LLDB
1412
import resilient_struct
1513

1614
// CHECK-LABEL: define{{.*}} swiftcc void @"$s17struct_resilience9takesSizeyy010resilient_A00D0VF"(%swift.opaque* noalias nocapture)
@@ -29,17 +27,9 @@ func f() {
2927
// CHECK-SAME: metadata !DIExpression(DW_OP_deref))
3028
// CHECK: %[[S1:.*]] = alloca i8,
3129
// CHECK: store i8* %[[S1]], i8** %[[ADDR]]
32-
33-
// CHECK-LLDB: %[[ADDR:.*]] = alloca %T16resilient_struct4SizeV
34-
// CHECK-LLDB: call void @llvm.dbg.declare(metadata %T16resilient_struct4SizeV* %[[ADDR]],
35-
// CHECK-LLDB-SAME: metadata ![[V1:[0-9]+]],
36-
// CHECK-LLDB-SAME: metadata !DIExpression())
3730
}
3831
f()
3932

4033
// CHECK: ![[TY:[0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Size",
4134

4235
// CHECK: ![[V1]] = !DILocalVariable(name: "s1", {{.*}}type: ![[TY]])
43-
44-
// CHECK-LLDB: ![[TY:[0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Size",
45-
// CHECK-LLDB: ![[V1]] = !DILocalVariable(name: "s1", {{.*}}type: ![[TY]])

test/IRGen/resilience_bypass.swift

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)