[llvm] [LTO] Turn ImportListsTy into a proper class (NFC) (PR #106427)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 17 11:25:37 PDT 2024


kazutakahirata wrote:

> We've encountered an issue when integrating this change into Rust. The problem is that this commit removed the possibility to fetch the import list without potentially modifying the DenseMap. Rust can read the ImportLists concurrently from multiple threads, and this may result in crashes, as reported at [rust-lang/rust#129749 (comment)](https://github.com/rust-lang/rust/pull/129749#issuecomment-2354417960). At least that's my current theory.
> 
> Rust was previously using `lookup()` instead of `operator[]`. Would it be possible to restore some form of read-only access to this data structure, whether via lookup or some other method?

So, are there two problems here?

- Preserving `const` for the import list if we are accessing it in a read-only manner
- Crashes from concurrent accesses

I'm happy to switch to `lookup` or `find` to preserve `const`, but I don't see how that fixes crashes.  In LLVM, we build the import lists for different destination modules in a single thread and then we do actual imports in parallel.  In Rust, do you do something a bit different like building import lists in parallel?


https://github.com/llvm/llvm-project/pull/106427


More information about the llvm-commits mailing list