Skip to content

Commit d682049

Browse files
authored
Under VFE/WME, disable mangled accessors and disable LLVM MergeFunctions (#39969)
1 parent 6d25565 commit d682049

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,14 +1972,32 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
19721972

19731973
if (Args.hasArg(OPT_enable_llvm_vfe)) {
19741974
Opts.VirtualFunctionElimination = true;
1975+
1976+
// FIXME(mracek): There are still some situations where we use mangled name
1977+
// without symbolic references, which means the dependency is not statically
1978+
// visible to the compiler/linker. Temporarily disable mangled accessors
1979+
// until we fix that.
1980+
Opts.DisableConcreteTypeMetadataMangledNameAccessors = true;
19751981
}
19761982

19771983
if (Args.hasArg(OPT_enable_llvm_wme)) {
19781984
Opts.WitnessMethodElimination = true;
1985+
1986+
// FIXME(mracek): There are still some situations where we use mangled name
1987+
// without symbolic references, which means the dependency is not statically
1988+
// visible to the compiler/linker. Temporarily disable mangled accessors
1989+
// until we fix that.
1990+
Opts.DisableConcreteTypeMetadataMangledNameAccessors = true;
19791991
}
19801992

19811993
if (Args.hasArg(OPT_conditional_runtime_records)) {
19821994
Opts.ConditionalRuntimeRecords = true;
1995+
1996+
// FIXME(mracek): There are still some situations where we use mangled name
1997+
// without symbolic references, which means the dependency is not statically
1998+
// visible to the compiler/linker. Temporarily disable mangled accessors
1999+
// until we fix that.
2000+
Opts.DisableConcreteTypeMetadataMangledNameAccessors = true;
19832001
}
19842002

19852003
if (Args.hasArg(OPT_internalize_at_link)) {

lib/IRGen/IRGen.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,12 @@ void swift::performLLVMOptimizations(const IRGenOptions &Opts,
231231
llvm::createAlwaysInlinerLegacyPass(/*insertlifetime*/false);
232232
}
233233

234+
// LLVM MergeFunctions doesn't understand the string in the metadata on calls
235+
// in @llvm.type.checked.load intrinsics is important, and mis-compiles
236+
// (mis-merge) unrelated functions.
237+
if (Opts.VirtualFunctionElimination || Opts.WitnessMethodElimination)
238+
PMBuilder.MergeFunctions = false;
239+
234240
bool RunSwiftSpecificLLVMOptzns =
235241
!Opts.DisableSwiftSpecificLLVMOptzns && !Opts.DisableLLVMOptzns;
236242

0 commit comments

Comments
 (0)