================
@@ -173,6 +174,16 @@ void BackendConsumer::HandleInterestingDecl(DeclGroupRef 
D) {
 
 // Links each entry in LinkModules into our module. Returns true on error.
 bool BackendConsumer::LinkInModules(llvm::Module *M) {
+  // Builtin bitcode is internalized into the module that links it, so each
+  // PTU of an incremental session needs its own copy. Plain bitcode files are
+  // still linked once.
+  if (LangOpts.IncrementalExtensions && LinkModules.empty()) {
+    if (loadLinkModules(CI, M->getContext(), LinkModules))
----------------
aaronj0 wrote:

> could loadLinkModules take an OnlyInternalized flag (defaulting to false so 
> the other callers are unaffected) and skip non-internalized LinkBitcodeFiles 
> entries 

Makes sense. Added `OnlyInternalized` to loadLinkModules, which skips an entry 
when `OnlyInternalized && !F.Internalize`.

> A two-input test with both kinds of bitcode would cover this.

Right, I've extended the unittest to link a plain bitcode file and delete it 
once the interpreter is up, which fails without the flag, since as pointed out 
the plain file gets reopened

https://github.com/llvm/llvm-project/pull/229788
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to