[IRGen] Setup LLVMRemarkStreamer using existing RemarkStreamer

Calling setupLLVMOptimizationRemarks overwrites the MainRemarkStreamer
in the LLVM context. This prevents LLVM from serializing the remark meta
information for the already emitted SIL remarks into the object file.
Without the meta information bitstream remarks don't work correctly.

Instead, emit SIL remarks and LLVM remarks to the same RemarkSerializer,
and keep the file stream alive until after CodeGen.
This commit is contained in:
Tobias Stadler
2025-06-06 18:20:30 +01:00
parent 9259c3eec4
commit 76568372f4
5 changed files with 33 additions and 39 deletions

View File

@@ -1469,10 +1469,9 @@ bool IRGenModule::IsWellKnownBuiltinOrStructralType(CanType T) const {
GeneratedModule IRGenModule::intoGeneratedModule() && {
return GeneratedModule{
std::move(LLVMContext),
std::unique_ptr<llvm::Module>{ClangCodeGen->ReleaseModule()},
std::move(TargetMachine)
};
std::move(LLVMContext),
std::unique_ptr<llvm::Module>{ClangCodeGen->ReleaseModule()},
std::move(TargetMachine), std::move(RemarkStream)};
}
bool IRGenerator::canEmitWitnessTableLazily(SILWitnessTable *wt) {