vgvassilev wrote:

> Would it be possible to add a test case?

Good point. Forgot to `git add` it. 

> Could you add a bit more detail how different mange contexts cause crashes in 
> TBAA?

On a high level clang's CodeGen is designed to work with a single llvm::Module. 
However, incremental compilation assumes multiple llvm::Modules per each 
incremental input. We trick CodeGen by creating a new CodeGenModule for each 
input. However, CodeGen has various of places where it caches things. That is, 
for convenience we store a reference to the CodeGenModule (CGM), MangleContext 
(MContext) and others which points to memory that was destroyed in the 
multi-module setup.

This patch essentially reduces the state we have and decreases the chances to 
hit something that was gone. It still accesses the same objects via 
CodeGenTypes (CGTypes) but they are connected to the correct CodeGenModule and 
MangleContext.

The approach is fragile but that's the only way I could think of to support the 
multi-module setups without major refactorings of CodeGen. It has been 
reasonably reliable over the years but we hit things like that occasionally...

Does that make sense?

https://github.com/llvm/llvm-project/pull/98138
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to