Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvm-wrapper: adapt for LLVM API changes #129749

Merged
merged 1 commit into from
Aug 31, 2024
Merged

Conversation

krasimirgg
Copy link
Contributor

No functional changes intended.

Updates the wrapper for 5c4lar/llvm-project@21eddfa.

@rustbot label: +llvm-main
r? @nikic

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. llvm-main Marks PRs that are making Rust work with LLVM main (this label is consumed by CI tooling) labels Aug 29, 2024
@@ -1205,7 +1205,11 @@ struct LLVMRustThinLTOData {
// Not 100% sure what these are, but they impact what's internalized and
// what's inlined across modules, I believe.
#if LLVM_VERSION_GE(18, 0)
#if LLVM_VERSION_GE(20, 0)
FunctionImporter::ImportListsTy ImportLists;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need this conditional. On older versions you can use the typedef as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the typedef FunctionImporter::ImportListsTy is new as well: llvm/llvm-project@4f15039#diff-870a2d0fa51c9349d66da88fd1938cef621de9b4ac0c96d71d694b90dbefbfebR153.

@krasimirgg krasimirgg marked this pull request as ready for review August 30, 2024 11:08
@nikic
Copy link
Contributor

nikic commented Aug 30, 2024

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Aug 30, 2024

📌 Commit 9c910e8 has been approved by nikic

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 30, 2024
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Aug 31, 2024
llvm-wrapper: adapt for LLVM API changes

No functional changes intended.

Updates the wrapper for 5c4lar/llvm-project@21eddfa.

`@rustbot` label: +llvm-main
r? `@nikic`
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 31, 2024
…kingjubilee

Rollup of 16 pull requests

Successful merges:

 - rust-lang#129123 (rustdoc-json: Add test for `Self` type)
 - rust-lang#129675 (allow BufReader::peek to be called on unsized types)
 - rust-lang#129678 (Deny imports of `rustc_type_ir::inherent` outside of type ir + new trait solver)
 - rust-lang#129723 (Simplify some extern providers)
 - rust-lang#129724 (Remove `Option<!>` return types.)
 - rust-lang#129725 (Stop using `ty::GenericPredicates` for non-predicates_of queries)
 - rust-lang#129730 (f32 docs: define 'arithmetic' operations)
 - rust-lang#129749 (llvm-wrapper: adapt for LLVM API changes)
 - rust-lang#129757 (Add a test for trait solver overflow in MIR inliner cycle detection)
 - rust-lang#129760 (Make the "detect-old-time" UI test more representative)
 - rust-lang#129762 (Update the `wasm-component-ld` binary dependency)
 - rust-lang#129767 (Remove `#[macro_use] extern crate tracing`, round 4)
 - rust-lang#129774 (Remove `#[macro_use] extern crate tracing` from rustdoc and rustfmt)
 - rust-lang#129780 (add crashtests for several old unfixed ICEs)
 - rust-lang#129782 (couple more crash tests)
 - rust-lang#129791 (mark joboet as on vacation)

r? `@ghost`
`@rustbot` modify labels: rollup
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Aug 31, 2024
llvm-wrapper: adapt for LLVM API changes

No functional changes intended.

Updates the wrapper for 5c4lar/llvm-project@21eddfa.

``@rustbot`` label: +llvm-main
r? ``@nikic``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 31, 2024
llvm-wrapper: adapt for LLVM API changes

No functional changes intended.

Updates the wrapper for 5c4lar/llvm-project@21eddfa.

```@rustbot``` label: +llvm-main
r? ```@nikic```
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 31, 2024
…iaskrgr

Rollup of 11 pull requests

Successful merges:

 - rust-lang#129630 (Document the broken C ABI of `wasm32-unknown-unknown`)
 - rust-lang#129711 (Expand NLL MIR dumps)
 - rust-lang#129730 (f32 docs: define 'arithmetic' operations)
 - rust-lang#129733 (Subtree update of `rust-analyzer`)
 - rust-lang#129749 (llvm-wrapper: adapt for LLVM API changes)
 - rust-lang#129757 (Add a test for trait solver overflow in MIR inliner cycle detection)
 - rust-lang#129760 (Make the "detect-old-time" UI test more representative)
 - rust-lang#129767 (Remove `#[macro_use] extern crate tracing`, round 4)
 - rust-lang#129774 (Remove `#[macro_use] extern crate tracing` from rustdoc and rustfmt)
 - rust-lang#129785 (Miri subtree update)
 - rust-lang#129791 (mark joboet as on vacation)

Failed merges:

 - rust-lang#129777 (Add `unreachable_pub`, round 4)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 31, 2024
…iaskrgr

Rollup of 12 pull requests

Successful merges:

 - rust-lang#129659 (const fn stability checking: also check declared language features)
 - rust-lang#129711 (Expand NLL MIR dumps)
 - rust-lang#129730 (f32 docs: define 'arithmetic' operations)
 - rust-lang#129733 (Subtree update of `rust-analyzer`)
 - rust-lang#129749 (llvm-wrapper: adapt for LLVM API changes)
 - rust-lang#129757 (Add a test for trait solver overflow in MIR inliner cycle detection)
 - rust-lang#129760 (Make the "detect-old-time" UI test more representative)
 - rust-lang#129767 (Remove `#[macro_use] extern crate tracing`, round 4)
 - rust-lang#129774 (Remove `#[macro_use] extern crate tracing` from rustdoc and rustfmt)
 - rust-lang#129785 (Miri subtree update)
 - rust-lang#129791 (mark joboet as on vacation)
 - rust-lang#129812 (interpret, codegen: tweak some comments and checks regarding Box with custom allocator)

Failed merges:

 - rust-lang#129777 (Add `unreachable_pub`, round 4)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 31, 2024
…iaskrgr

Rollup of 12 pull requests

Successful merges:

 - rust-lang#129659 (const fn stability checking: also check declared language features)
 - rust-lang#129711 (Expand NLL MIR dumps)
 - rust-lang#129730 (f32 docs: define 'arithmetic' operations)
 - rust-lang#129733 (Subtree update of `rust-analyzer`)
 - rust-lang#129749 (llvm-wrapper: adapt for LLVM API changes)
 - rust-lang#129757 (Add a test for trait solver overflow in MIR inliner cycle detection)
 - rust-lang#129760 (Make the "detect-old-time" UI test more representative)
 - rust-lang#129767 (Remove `#[macro_use] extern crate tracing`, round 4)
 - rust-lang#129774 (Remove `#[macro_use] extern crate tracing` from rustdoc and rustfmt)
 - rust-lang#129785 (Miri subtree update)
 - rust-lang#129791 (mark joboet as on vacation)
 - rust-lang#129812 (interpret, codegen: tweak some comments and checks regarding Box with custom allocator)

Failed merges:

 - rust-lang#129777 (Add `unreachable_pub`, round 4)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 8c7a7e3 into rust-lang:master Aug 31, 2024
6 checks passed
@rustbot rustbot added this to the 1.82.0 milestone Aug 31, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 31, 2024
Rollup merge of rust-lang#129749 - krasimirgg:llvm-20-lto, r=nikic

llvm-wrapper: adapt for LLVM API changes

No functional changes intended.

Updates the wrapper for 5c4lar/llvm-project@21eddfa.

````@rustbot```` label: +llvm-main
r? ````@nikic````
@tmandry
Copy link
Member

tmandry commented Sep 17, 2024

This PR causes an assertion failure in one of our builds, using the default rustc invocation.

rustc: /src/rust-toolchain/rust/fuchsia-build/x86_64-unknown-linux-gnu/llvm/include/llvm/ADT/DenseMap.h:451: void llvm::DenseMapBase<llvm::DenseMap<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind>>>, llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind>>, llvm::DenseMapInfo<StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind>>>>::moveFromOldBuckets(BucketT *, BucketT *) [DerivedT = llvm::DenseMap<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind>>>, KeyT = llvm::StringRef, ValueT = llvm::DenseMap<llvm::StringRef, std::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind>>, KeyInfoT = llvm::DenseMapInfo<StringRef, void>, BucketT = llvm::detail::DenseMapPair<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind>>>]: Assertion `!FoundVal && "Key already in new map?"' failed.

Backtrace
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
44      ./nptl/pthread_kill.c: No such file or directory.
[Current thread is 1 (Thread 0x7fffaea006c0 (LWP 766358))]
warning: Missing auto-load script at offset 0 in section .debug_gdb_scripts
of file /redacted/share/rustc.
Use `info auto-load python-scripts [REGEXP]' to list them.
(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1  0x00007ffff00a714f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2  0x00007ffff0059102 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff00424f2 in __GI_abort () at ./stdlib/abort.c:79
#4  0x00007ffff0042415 in __assert_fail_base (fmt=0x7ffff01b7e08 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
    assertion=assertion@entry=0x7ffff0c5b9e1 "!FoundVal && \"Key already in new map?\"",
    file=file@entry=0x7ffff0c1b058 "/src/rust-toolchain/rust/fuchsia-build/x86_64-unknown-linux-gnu/llvm/include/llvm/ADT/DenseMap.h", line=line@entry=451,
    function=function@entry=0x7ffff0c9d4b6 "void llvm::DenseMapBase<llvm::DenseMap<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind>>>, llvm::StringRef, llvm::DenseMap<llvm:"...) at ./assert/assert.c:92
#5  0x00007ffff0051d32 in __assert_fail (assertion=0x7ffff0c5b9e1 "!FoundVal && \"Key already in new map?\"",
    file=0x7ffff0c1b058 "/src/rust-toolchain/rust/fuchsia-build/x86_64-unknown-linux-gnu/llvm/include/llvm/ADT/DenseMap.h",
    line=451,
    function=0x7ffff0c9d4b6 "void llvm::DenseMapBase<llvm::DenseMap<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind>>>, llvm::StringRef, llvm::DenseMap<llvm:"...) at ./assert/assert.c:101
#6  0x00007ffff2d4a69f in llvm::DenseMapBase<llvm::DenseMap<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > > > >, llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > > > >::moveFromOldBuckets (this=0x7fffb9023188, OldBucketsBegin=OldBucketsBegin@entry=0x7fffe12fb800,
    OldBucketsEnd=OldBucketsEnd@entry=0x7fffe12fe000)
    at /src/rust-toolchain/rust/fuchsia-build/x86_64-unknown-linux-gnu/llvm/include/llvm/ADT/DenseMap.h:451
#7  0x00007ffff2d4a459 in llvm::DenseMap<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > > > >::grow (this=<optimized out>, AtLeast=<optimized out>)
    at /src/rust-toolchain/rust/fuchsia-build/x86_64-unknown-linux-gnu/llvm/include/llvm/ADT/DenseMap.h:856
#8  0x00007ffff2d4a39f in llvm::DenseMapBase<llvm::DenseMap<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > > > >, llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > > > >::grow (this=<optimized out>, AtLeast=<optimized out>)
--Type <RET> for more, q to quit, c to continue without paging--
    at /src/rust-toolchain/rust/fuchsia-build/x86_64-unknown-linux-gnu/llvm/include/llvm/ADT/DenseMap.h:580
#9  0x00007ffff2d4a39f in llvm::DenseMapBase<llvm::DenseMap<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > > > >, llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > >, llvm::DenseMapInfo<llvm::Stri

ngRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > > > >::InsertIntoBucketImpl<llvm::StringRef> (this=0xbb0c8, this@entry=0x7fffb9023188, Key=..., Lookup=...,
    TheBucket=0x7ffff00a70ec <__pthread_kill_implementation+268>)
   from /src/rust-toolchain/rust/install/fuchsia-rust/bin/../lib/librustc_driver-1a5503ce123cfa4e.so
#10 0x00007ffff2d40a45 in llvm::DenseMapBase<llvm::DenseMap<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > > > >, llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > > > >::InsertIntoBucket<llvm::StringRef> (this=0x7fffb9023188, TheBucket=0x7ffff00a70ec <__pthread_kill_implementation+268>, Key=...)
    at /src/rust-toolchain/rust/fuchsia-build/x86_64-unknown-linux-gnu/llvm/include/llvm/ADT/DenseMap.h:590
#11 llvm::DenseMapBase<llvm::DenseMap<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > > > >, llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > > > >::FindAndConstruct (this=0x7fffb9023188, Key=...)
    at /src/rust-toolchain/rust/fuchsia-build/x86_64-unknown-linux-gnu/llvm/include/llvm/ADT/DenseMap.h:381
#12 llvm::DenseMapBase<llvm::DenseMap<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValue--Type <RET> for more, q to quit, c to continue without paging--
Summary::ImportKind> > > > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > > > >, llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, llvm::DenseMap<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > >, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::__2::unordered_map<unsigned long, llvm::GlobalValueSummary::ImportKind, std::__2::hash<unsigned long>, std::__2::equal_to<unsigned long>, std::__2::allocator<std::__2::pair<unsigned long const, llvm::GlobalValueSummary::ImportKind> > > > > > >::operator[] (this=0x7fffb9023188, Key=...)
    at /src/rust-toolchain/rust/fuchsia-build/x86_64-unknown-linux-gnu/llvm/include/llvm/ADT/DenseMap.h:385
#13 LLVMRustPrepareThinLTOImport (Data=0x7fffb9023000, M=0x7fffc3c62000, TM=0x7fffc3c19000) at llvm-wrapper/PassWrapper.cpp:1434
#14 0x00007ffff2d2fa25 in rustc_codegen_llvm::back::lto::optimize_thin_module (thin_module=..., cgcx=0x7fffae9fe888)
    at compiler/rustc_codegen_llvm/src/back/lto.rs:786
#15 rustc_codegen_llvm::{impl#3}::optimize_thin (cgcx=0x7fffae9fe888, thin=...) at compiler/rustc_codegen_llvm/src/lib.rs:233

#16 0x00007ffff2c2fceb in rustc_codegen_ssa::back::lto::LtoModuleCodegen<rustc_codegen_llvm::LlvmCodegenBackend>::optimize<rustc_codegen_llvm::LlvmCodegenBackend> (self=..., cgcx=0x7fffae9fe888) at compiler/rustc_codegen_ssa/src/back/lto.rs:75
#17 rustc_codegen_ssa::back::write::execute_lto_work_item<rustc_codegen_llvm::LlvmCodegenBackend> (cgcx=0x7fffae9fe888, module=...,
    module_config=0x7fffbd380470) at compiler/rustc_codegen_ssa/src/back/write.rs:1012
#18 rustc_codegen_ssa::back::write::spawn_work::{closure#0}<rustc_codegen_llvm::LlvmCodegenBackend> () at compiler/rustc_codegen_ssa/src/back/write.rs:1846
#19 rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()> () at compiler/rustc_codegen_llvm/src/lib.rs:154
#20 std::sys::backtrace::__rust_begin_short_backtrace<rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure_env#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()>, ()> (f=...) at library/std/src/sys/backtrace.rs:154
#21 0x00007ffff2c63de9 in std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure#0}<rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure_env#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()>, ()> () at library/std/src/thread/mod.rs:522
#22 core::panic::unwind_safe::{impl#23}::call_once<(), std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure_env#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()>, ()>> (self=...)
    at library/core/src/panic/unwind_safe.rs:272
#23 std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure_env#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()>, ()>>, ()> (data=<optimized out>) at library/std/src/panicking.rs:557
#24 std::panicking::try<(), core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure_env#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()>, ()>>> (f=<error reading variable: Cannot access memory at address 0xc8>) at library/std/src/panicking.rs:520
#25 std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure_env#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()>, ()>>, ()> (f=<error reading variable: Cannot access memory at address 0xc8>) at library/std/src/panic.rs:345
#26 std::thread::{impl#0}::spawn_unchecked_::{closure#1}<rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure_env#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()>, ()> () at library/std/src/thread/mod.rs:521
#27 core::ops::function::FnOnce::call_once<std::thread::{impl#0}::spawn_unchecked_::{closure_env#1}<rustc_codegen_llvm::{impl#2}::spawn_named_thread::{closure_env#0}<rustc_codegen_ssa::back::write::spawn_work::{closure_env#0}<rustc_codegen_llvm::LlvmCodegenBackend>, ()>, ()>, ()> ()
    at library/core/src/ops/function.rs:250
#28 0x00007ffff78efb7b in alloc::boxed::{impl#48}::call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global> (self=...,
    args=<optimized out>) at alloc/src/boxed.rs:2229
#29 alloc::boxed::{impl#48}::call_once<(), alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>, alloc::alloc::Global> (
    self=0x7fffcf10c280, args=<optimized out>) at alloc/src/boxed.rs:2229
#30 std::sys::pal::unix::thread::{impl#2}::new::thread_start (main=0x7fffcf10c280) at std/src/sys/pal/unix/thread.rs:105
#31 0x00007ffff00a539c in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:444
#32 0x00007ffff0126608 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Unfortunately I don't have the exact commit used to produce the above backtrace, but it seems very likely that the assertion is firing from the first use of operator[] added in this PR.

@@ -1414,13 +1418,13 @@ LLVMRustPrepareThinLTOInternalize(const LLVMRustThinLTOData *Data,
return true;
}

extern "C" bool LLVMRustPrepareThinLTOImport(const LLVMRustThinLTOData *Data,
extern "C" bool LLVMRustPrepareThinLTOImport(LLVMRustThinLTOData *Data,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem here is that this const removal did not get propagated to ffi.rs -- if it did, we'd probably get a borrow checker error :)

It looks like this function is called from optimize_thin_module, which I believe is run in parallel, so we might end up resizing the map while another thread holds a reference to it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can't really fix this without LLVM exposing an additional API. I left a comment on the PR at llvm/llvm-project#106427 (comment).

matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this pull request Sep 17, 2024
…nikic"

This reverts commit 8c7a7e3, reversing
changes made to a00bd75.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 17, 2024
Revert rust-lang#129749 to fix segfault in LLVM

This reverts commit 8c7a7e3, reversing changes made to a00bd75.

Reported in rust-lang#129749 (comment). `@nikic's` theory is that the LLVM API changed in a way that makes it impossible to use concurrently from multiple threads (llvm/llvm-project#106427 (comment)). I pinged `@krasimirgg` who was fine with reverting.

r? `@rust-lang/wg-llvm`
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 17, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#129477 (Fix fluent diagnostics)
 - rust-lang#129674 (Add new_cyclic_in for Rc and Arc)
 - rust-lang#130452 (Update Trusty target maintainers)
 - rust-lang#130467 (Miri subtree update)
 - rust-lang#130477 (Revert rust-lang#129749 to fix segfault in LLVM)

r? `@ghost`
`@rustbot` modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 17, 2024
Rollup merge of rust-lang#130477 - tmandry:revert-llvm-20-lto, r=tmandry

Revert rust-lang#129749 to fix segfault in LLVM

This reverts commit 8c7a7e3, reversing changes made to a00bd75.

Reported in rust-lang#129749 (comment). `@nikic's` theory is that the LLVM API changed in a way that makes it impossible to use concurrently from multiple threads (llvm/llvm-project#106427 (comment)). I pinged `@krasimirgg` who was fine with reverting.

r? `@rust-lang/wg-llvm`
@nikic
Copy link
Contributor

nikic commented Sep 18, 2024

With llvm/llvm-project#109036 (comment) merged we should be able to keep using lookup() and only do the type change.

Now the remaining question here is why we have modules for which seemingly no import list was computed. Based on some debug output during the libstd build we see something like this: https://gist.github.com/nikic/3f257e2a09b729ccb4b64c42446fa0de

In other words, these are all modules that are either completely empty or only contain module-level inline assembly. If the module doesn't define functions, then no ImportList for it will be populated.

While Rust probably shouldn't be submitting completely empty modules to LLVM (where do these come from...?) I don't think there's a fundamental bug here on the Rust side.

@nikic
Copy link
Contributor

nikic commented Sep 18, 2024

Ah, it looks like the reason why this problem doesn't occur on the LLVM side is this code: https://github.com/llvm/llvm-project/blob/0dd56858fe188419182a57d0e03c8cd0aa693867/llvm/lib/LTO/ThinLTOCodeGenerator.cpp#L1102-L1111 It forces an entry to be created in all maps, even if that would normally not happen.

@krasimirgg
Copy link
Contributor Author

Working on new version of this patch with lookup-s().

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 18, 2024
llvm-wrapper: adapt for LLVM API changes, second try

This is a re-work of rust-lang#129749 after LLVM brought back the APIs used by rust.

No functional changes intended.

`@rustbot` label: +llvm-main
r? `@nikic`
cc: `@tmandry`
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 18, 2024
Rollup merge of rust-lang#130509 - krasimirgg:llvm-20-2, r=nikic

llvm-wrapper: adapt for LLVM API changes, second try

This is a re-work of rust-lang#129749 after LLVM brought back the APIs used by rust.

No functional changes intended.

`@rustbot` label: +llvm-main
r? `@nikic`
cc: `@tmandry`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm-main Marks PRs that are making Rust work with LLVM main (this label is consumed by CI tooling) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants