Skip to content

Commit 690373e

Browse files
committed
Under VFE/WME, disable mangled accessors and disable LLVM MergeFunctions
1 parent 0f30978 commit 690373e

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
@@ -1958,14 +1958,32 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
19581958

19591959
if (Args.hasArg(OPT_enable_llvm_vfe)) {
19601960
Opts.VirtualFunctionElimination = true;
1961+
1962+
// FIXME(mracek): There are still some situations where we use mangled name
1963+
// without symbolic references, which means the dependency is not statically
1964+
// visible to the compiler/linker. Temporarily disable mangled accessors
1965+
// until we fix that.
1966+
Opts.DisableConcreteTypeMetadataMangledNameAccessors = true;
19611967
}
19621968

19631969
if (Args.hasArg(OPT_enable_llvm_wme)) {
19641970
Opts.WitnessMethodElimination = true;
1971+
1972+
// FIXME(mracek): There are still some situations where we use mangled name
1973+
// without symbolic references, which means the dependency is not statically
1974+
// visible to the compiler/linker. Temporarily disable mangled accessors
1975+
// until we fix that.
1976+
Opts.DisableConcreteTypeMetadataMangledNameAccessors = true;
19651977
}
19661978

19671979
if (Args.hasArg(OPT_conditional_runtime_records)) {
19681980
Opts.ConditionalRuntimeRecords = true;
1981+
1982+
// FIXME(mracek): There are still some situations where we use mangled name
1983+
// without symbolic references, which means the dependency is not statically
1984+
// visible to the compiler/linker. Temporarily disable mangled accessors
1985+
// until we fix that.
1986+
Opts.DisableConcreteTypeMetadataMangledNameAccessors = true;
19691987
}
19701988

19711989
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)