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

Upgrade to LLVM 16 #107224

Merged
merged 4 commits into from
Mar 18, 2023
Merged

Upgrade to LLVM 16 #107224

merged 4 commits into from
Mar 18, 2023

Conversation

nikic
Copy link
Contributor

@nikic nikic commented Jan 23, 2023

This updates Rust to LLVM 16. It also updates our host compiler for dist-x86_64-linux to LLVM 16. The reason for that is that Bolt from LLVM 15 is not capable of compiling LLVM 16 (llvm/llvm-project#61114).

LLVM 16.0.0 has been released on March 18, while Rust 1.70 will become stable on June 1.

Tested images: dist-x86_64-linux, dist-riscv64-linux (alt), dist-x86_64-illumos, dist-various-1, dist-various-2, dist-powerpc-linux, wasm32, armhf-gnu
Tested images until the usual IPv6 failures: test-various

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 23, 2023
@matthiaskrgr matthiaskrgr marked this pull request as ready for review January 23, 2023 16:01
@matthiaskrgr matthiaskrgr marked this pull request as draft January 23, 2023 16:01
@nagisa
Copy link
Member

nagisa commented Jan 23, 2023

How neat is it that upgrades are as simple as this now!

@nikic
Copy link
Contributor Author

nikic commented Jan 25, 2023

@bors try @rust-timer queue

How neat is it that upgrades are as simple as this now!

It's quiet. Too quiet...

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 25, 2023
@bors
Copy link
Contributor

bors commented Jan 25, 2023

⌛ Trying commit 776fb8e470bab3324cc0d9e34ab6a905f774f19e with merge e6dbb34783cfa1de81bc2fffcbb8bbe0a5a4f9fa...

@bors
Copy link
Contributor

bors commented Jan 25, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 25, 2023
@rust-log-analyzer

This comment has been minimized.

@nikic
Copy link
Contributor Author

nikic commented Jan 25, 2023

Ha, I did say it was too quiet!

This is kind of weird though, because I tested dist-x86_64-linux locally, though I was using the DEPLOY_ALT=1 configuration. Either this only happens with DEPLOY=1, or something managed to break in the one day in between.

@nikic
Copy link
Contributor Author

nikic commented Jan 27, 2023

The backtrace for the crash looks like this:

/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc_driver-9b7e072587e53c32.so(+0x1d266e3)[0x7f99701266e3]
/lib64/libpthread.so.0(+0xf630)[0x7f996d80f630]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so(_ZNK4llvm12DIExpression7isValidEv+0xb)[0x7f996549df0b]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so(_ZNK4llvm12DIExpression26isSingleLocationExpressionEv+0x9)[0x7f9966fd4889]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so(_ZN4llvm12DIExpression30convertToNonVariadicExpressionEPKS0_+0x1c)[0x7f9966fd4570]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so(+0x77d34ff)[0x7f9966fd34ff]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so(+0x77f1eb9)[0x7f9966ff1eb9]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so(_ZN15LiveDebugValues16InstrRefBasedLDV19transferRegisterDefERN4llvm12MachineInstrE+0x13a7)[0x7f9966fe10a9]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so(+0x77ca545)[0x7f9966fca545]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so(_ZN15LiveDebugValues16InstrRefBasedLDV21depthFirstVLocAndEmitEjRKN4llvm8DenseMapIPKNS1_12LexicalScopeEPKNS1_10DILocationENS1_12DenseMapInfoIS5_vEENS1_6detail12DenseMapPairIS5_S8_EEEERKNS2_IS5_NS1_8SmallSetINS1_13DebugVariableELj4ESt4lessISI_EEESA_NSC_IS5_SL_EEEERNS2_IS5_NS1_11SmallPtrSetIPNS1_17MachineBasicBlockELj4EEESA_NSC_IS5_ST_EEEERNS1_11SmallVectorINSX_ISt4pairISI_NS_8DbgValueEELj8EEELj8EEERSt10unique_ptrIA_S14_IA_NS_10ValueIDNumESt14default_deleteIS16_EES17_IS1A_EES1D_RNS1_15SmallVectorImplINS_11VLocTrackerEEERNS1_15MachineFunctionERNS2_ISI_jNS9_ISI_vEENSC_ISI_jEEEERKNS1_16TargetPassConfigE+0xb09)[0x7f9966fc241d]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so(_ZN15LiveDebugValues16InstrRefBasedLDV12ExtendRangesERN4llvm15MachineFunctionEPNS1_20MachineDominatorTreeEPNS1_16TargetPassConfigEjj+0x22f5)[0x7f9966fbbf93]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0xf5e)[0x7f996710d7de]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x2f)[0x7f996710b66f]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x371)[0x7f996710a633]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc_driver-9b7e072587e53c32.so(+0x3d46e20)[0x7f9972146e20]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc_driver-9b7e072587e53c32.so(+0x192acee)[0x7f996fd2acee]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc_driver-9b7e072587e53c32.so(+0x192f041)[0x7f996fd2f041]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc_driver-9b7e072587e53c32.so(+0x19611eb)[0x7f996fd611eb]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc_driver-9b7e072587e53c32.so(+0x195a5c4)[0x7f996fd5a5c4]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc_driver-9b7e072587e53c32.so(+0x1a20415)[0x7f996fe20415]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc_driver-9b7e072587e53c32.so(+0x19c9fae)[0x7f996fdc9fae]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-6e3768d17ed5c91f.so(rust_metadata_std_f225247c7b5cd0aa+0x10d385)[0x7f9972945385]
/lib64/libpthread.so.0(+0x7ea5)[0x7f996d807ea5]
/lib64/libc.so.6(clone+0x6d)[0x7f996d4feb0d]

I haven't been able to reproduce this outside of rustc yet.

Edit: With symbols:

#0  0x00007fffeaa9df0b in llvm::DIExpression::isValid() const ()
   from /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so
#1  0x00007fffec5d4889 in llvm::DIExpression::isSingleLocationExpression() const ()
   from /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so
#2  0x00007fffec5d4570 in llvm::DIExpression::convertToNonVariadicExpression(llvm::DIExpression const*) ()
   from /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so
#3  0x00007fffec5d34ff in TransferTracker::recoverAsEntryValue(llvm::DebugVariable const&, LiveDebugValues::DbgValueProperties const&, LiveDebugValues::ValueIDNum const&) ()
   from /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so
#4  0x00007fffec5f1eb9 in TransferTracker::clobberMloc(LiveDebugValues::LocIdx, LiveDebugValues::ValueIDNum, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, bool) ()
   from /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so
#5  0x00007fffec5e10a9 in LiveDebugValues::InstrRefBasedLDV::transferRegisterDef(llvm::MachineInstr&) ()
   from /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so
#6  0x00007fffec5ca545 in LiveDebugValues::InstrRefBasedLDV::depthFirstVLocAndEmit(unsigned int, llvm::DenseMap<llvm::LexicalScope const*, llvm::DILocation const*, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail::DenseMapPair<llvm::LexicalScope const*, llvm::DILocation const*> > const&, llvm::DenseMap<llvm::LexicalScope const*, llvm::SmallSet<llvm::DebugVariable, 4u, std::less<llvm::DebugVariable> >, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail::DenseMapPair<llvm::LexicalScope const*, llvm::SmallSet<llvm::DebugVariable, 4u, std::less<llvm::DebugVariable> > > > const&, llvm::DenseMap<llvm::LexicalScope const*, llvm::SmallPtrSet<llvm::MachineBasicBlock*, 4u>, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail::DenseMapPair<llvm::LexicalScope const*, llvm::SmallPtrSet<llvm::MachineBasicBlock*, 4u> > >&, llvm::SmallVector<llvm::SmallVector<std::pair<llvm::DebugVariable, LiveDebugValues::DbgValue>, 8u>, 8u>&, std::unique_ptr<std::unique_ptr<LiveDebugValues::ValueIDNum [], std::default_delete<LiveDebugValues::ValueIDNum []> > [], std::default_delete<std::unique_ptr<LiveDebugValues::ValueIDNum [], std::default_delete<LiveDebugValues::ValueIDNum []> > []> >&, std::unique_ptr<std::unique_ptr<LiveDebugValues::ValueIDNum [], std::default_delete<LiveDebugValues::ValueIDNum []> > [], std::default_delete<std::unique_ptr<LiveDebugValues::ValueIDNum [], std::default_delete<LiveDebugValues::ValueIDNum []> > []> >&, llvm::SmallVectorImpl<LiveDebugValues::VLocTracker>&, llvm::MachineFunction&, llvm::DenseMap<llvm::DebugVariable, unsigned int, llvm::DenseMapInfo<llvm::DebugVariable, void>, llvm::detail::DenseMapPair<llvm::DebugVariable, unsigned int> >&, llvm::TargetPassConfig const&)::$_13::operator()(llvm::MachineBasicBlock&) const
    ()
   from /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so
#7  0x00007fffec5c241d in LiveDebugValues::InstrRefBasedLDV::depthFirstVLocAndEmit(unsigned int, llvm::DenseMap<llvm::LexicalScope const*, llvm::DILocation const*, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail::DenseMapPair<llvm::LexicalScope const*, llvm::DILocation const*> > const&, llvm::DenseMap<llvm::LexicalScope const*, llvm::SmallSet<llvm::DebugVariable, 4u, std::less<llvm::DebugVariable> >, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail::DenseMapPair<llvm::LexicalScope const*, llvm::SmallSet<llvm::DebugVariable, 4u, std::less<llvm::DebugVariable> > > > const&, llvm::DenseMap<llvm::LexicalScope const*, llvm::SmallPtrSet<llvm::MachineBasicBlock*, 4u>, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail::DenseMapPair<llvm::LexicalScope const*, llvm::SmallPtrSet<llvm::MachineBasicBlock*, 4u> > >&, llvm::SmallVector<llvm::SmallVector<std::pair<llvm::DebugVariable, LiveDebugValues::DbgValue>, 8u>, 8u>&, std::unique_ptr<std::unique_ptr<LiveDebugValues::ValueIDNum [], std::default_delete<LiveDebugValues::ValueIDNum []> > [], std::default_delete<std::unique_ptr<LiveDebugValues::ValueIDNum [], std::default_delete<LiveDebugValues::ValueIDNum []> > []> >&, std::unique_ptr<std::unique_ptr<LiveDebugValues::ValueIDNum [], std::default_delete<LiveDebugValues::ValueIDNum []> > [], std::default_delete<std::unique_ptr<LiveDebugValues::ValueIDNum [], std::default_delete<LiveDebugValues::ValueIDNum []> > []> >&, llvm::SmallVectorImpl<LiveDebugValues::VLocTracker>&, llvm::MachineFunction&, llvm::DenseMap<llvm::DebugVariable, unsigned int, llvm::DenseMapInfo<llvm::DebugVariable, void>, llvm::detail::DenseMapPair<llvm::DebugVariable, unsigned int> >&, llvm::TargetPassConfig const&) ()
   from /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so
#8  0x00007fffec5bbf93 in LiveDebugValues::InstrRefBasedLDV::ExtendRanges(llvm::MachineFunction&, llvm::MachineDominatorTree*, llvm::TargetPassConfig*, unsigned int, unsigned int) ()
   from /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so
#9  0x00007fffec70d7de in llvm::FPPassManager::runOnFunction(llvm::Function&) ()
   from /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so
#10 0x00007fffec70b66f in llvm::FPPassManager::runOnModule(llvm::Module&) ()
   from /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/../lib/../lib/libLLVM-16-rust-1.69.0-nightly.so
#11 0x00007fffec70a633 in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()

@cuviper
Copy link
Member

cuviper commented Jan 27, 2023

Note that it did complete one build, but breaks in further PGO. On my machine, it crashed while "Building stage1 library artifacts" in this command:

rust/src/ci/pgo.sh

Lines 194 to 198 in d7948c8

# Gather BOLT profile (BOLT is currently only available on Linux)
python3 ../x.py build --target=$PGO_HOST --host=$PGO_HOST \
--stage 2 library/std \
--llvm-profile-use=${LLVM_PROFILE_MERGED_FILE} \
--llvm-bolt-profile-generate

I don't see a detailed crash in the CI log, but it seems to have gotten just past that and failed in the next collector.

@nikic
Copy link
Contributor Author

nikic commented Jan 27, 2023

For me and in CI the crash is during the third profile collection, using the build that has been PGO optimized and has BOLT instrumentation.

Probably a thing to try would be to drop the BOLT part and see whether that works. If not, then this is probably a PGO miscompile. Doesn't sound fun to debug, might be easiest to bisect.

@nagisa
Copy link
Member

nagisa commented Jan 27, 2023

It's quiet. Too quiet...

I am really, really sorry for raising that 🏴 😿

@nikic
Copy link
Contributor Author

nikic commented Jan 30, 2023

Hrm, I can reproduce a crash even on llvm/llvm-project@3c0c24e, which I had previously successfully tested in #105956.

@nikic
Copy link
Contributor Author

nikic commented Jan 30, 2023

Dropping --llvm-bolt-profile-generate works though (that is, it fails at merge-fdata which is expected, but doesn't crash before that).

@Kobzol
Copy link
Contributor

Kobzol commented Feb 6, 2023

BOLT isn't always super stable, so it might very well be caused by it. We use BOLT 15.0.0, we can try to update to a more recent LLVM commit, hopefully it contains some fixes that would allow it to instrument LLVM properly again.

@cuviper
Copy link
Member

cuviper commented Feb 7, 2023

I tried a local build with 15.0.7 in build-clang.sh, and it crashed in the same place. Maybe I'll try a 16-rc next.

@nikic
Copy link
Contributor Author

nikic commented Feb 16, 2023

Using 16.0.0-rc2 as the host compiler fails with:

  = note: "clang" "-Wl,--version-script=/tmp/rustc8pJ5Fo/list" "-m64" "/tmp/rustc8pJ5Fo/symbols.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/test-787e706ccc780e1f.test.1e9b9795-cgu.0.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/test-787e706ccc780e1f.3viefkuvyhuvla25.rcgu.rmeta" "-Wl,--as-needed" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/release/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/build/compiler_builtins-700899a0a7bfddf6/out" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/build/profiler_builtins-29e7b7f6504265ec/out" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libgetopts-53ef18f824c63f01.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libunicode_width-8b649cb3363b0d60.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/librustc_std_workspace_std-df4ce9b32844b0d6.rlib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps" "-Wl,-Bdynamic" "-lstd-bf020b253a5c38f2" "-Wl,-Bstatic" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libcompiler_builtins-d25e30fbe2eaf7f3.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libtest-787e706ccc780e1f.so" "-shared" "-Wl,-zrelro,-znow" "-Wl,-O1" "-nodefaultlibs" "-Wl,-z,origin" "-Wl,-rpath,$ORIGIN/../lib" "-fuse-ld=lld"
  = note: ld.lld: error: version script assignment of 'global' to symbol '__rust_alloc' failed: symbol not defined
          ld.lld: error: version script assignment of 'global' to symbol '__rust_alloc_error_handler' failed: symbol not defined
          ld.lld: error: version script assignment of 'global' to symbol '__rust_alloc_error_handler_should_panic' failed: symbol not defined
          ld.lld: error: version script assignment of 'global' to symbol '__rust_alloc_error_handler_should_panic' failed: symbol not defined
          ld.lld: error: version script assignment of 'global' to symbol '__rust_alloc_zeroed' failed: symbol not defined
          ld.lld: error: version script assignment of 'global' to symbol '__rust_dealloc' failed: symbol not defined
          ld.lld: error: version script assignment of 'global' to symbol '__rust_realloc' failed: symbol not defined
          clang-16: error: linker command failed with exit code 1 (use -v to see invocation)

Presumably due to https://reviews.llvm.org/D135402.

@TimNN
Copy link
Contributor

TimNN commented Feb 16, 2023

Related: #105967

@nikic
Copy link
Contributor Author

nikic commented Feb 17, 2023

@TimNN Yeah, that's the same problem.

@chbaker0 Unfortunately, the patch from #108017 doesn't seem to actually fix the issue for this case. Possibly this is due to the issue mentioned by @bjorn3 in #105967 (comment)? I dumped the rustc invocation, and it looks like this:

/checkout/obj/build/bootstrap/debug/rustc --crate-name test --edition=2021 library/test/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type dylib --crate-type rlib --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 -C debuginfo=1 --cfg 'feature="backtrace"' --cfg 'feature="compiler-builtins-c"' --cfg 'feature="default"' --cfg 'feature="panic-unwind"' --cfg 'feature="profiler"' --cfg 'feature="std_detect_dlsym_getauxval"' --cfg 'feature="std_detect_file_io"' -Zunstable-options --check-cfg 'names()' --check-cfg 'values()' -C metadata=47db22925d94bbfe -C extra-filename=-47db22925d94bbfe --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -C linker=clang -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/release/deps --extern cfg_if=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libcfg_if-2fa409080a8dff6f.rlib --extern core=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libcore-1c1f92ee49f53426.rlib --extern getopts=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libgetopts-4d68e2b49daefb23.rlib --extern libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/liblibc-4c7f9da9127bfe1a.rlib --extern panic_abort=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libpanic_abort-82df01dfe6ebb3f0.rlib --extern panic_unwind=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libpanic_unwind-2d34489f1786e993.rlib --extern proc_macro=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libproc_macro-26046e6631aace8d.rlib --extern std=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libstd-82380a8953d23577.so --extern std=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/libstd-82380a8953d23577.rlib --cfg=bootstrap -Csymbol-mangling-version=legacy -Zunstable-options -Zunstable-options '--check-cfg=values(bootstrap)' '--check-cfg=values(stdarch_intel_sde)' '--check-cfg=values(no_fp_fmt_parse)' '--check-cfg=values(no_global_oom_handling)' '--check-cfg=values(no_rc)' '--check-cfg=values(no_sync)' '--check-cfg=values(freebsd12)' '--check-cfg=values(backtrace_in_libstd)' '--check-cfg=values(target_env,"libnx")' '--check-cfg=values(target_arch,"asmjs","spirv","nvptx","xtensa")' -Zmacro-backtrace -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Clink-args=-fuse-ld=lld -Csplit-debuginfo=off -Cprefer-dynamic '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Z binary-dep-depinfo -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/build/compiler_builtins-a215c8d86e5def78/out -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/build/profiler_builtins-b70bb5fb646b81d5/out

Notably, we're building both a dylib and rlib, and the --extern std dependency is available both as dylib and rlib, so I'm assuming that's exactly the problematic situation where we would need separate export lists for both crate types.

@the8472
Copy link
Member

the8472 commented Mar 20, 2023

Does a dist-x86_64-linux blow up if it's set to use the downloaded llvm or is it just other builders? I.e. could it be an incompatibility between the build environments?

@nikic
Copy link
Contributor Author

nikic commented Mar 20, 2023

@the8472 Could be. My first suspicion would be an ABI mismatch. dist-x86_64-linux builds with clang, while most other builders use gcc. And createTargetMachine() was switched to use std::optional instead of llvm::Optional in this release.

@alexcrichton
Copy link
Member

This caused several failures in stdarch CI: rust-lang/stdarch#1394

wasm32-wasi (cc @alexcrichton):

Thanks for the cc! Let's continue that thread of discussion in rust-lang/stdarch#1396 (nothing amiss with LLVM 16 itself, just backend changes as expected)

vadorovsky added a commit to vadorovsky/bpf-linker that referenced this pull request Mar 20, 2023
Rust recently updated to LLVM 16 (rust-lang/rust#107224) and the change
is likely to be provided in next nightly builds.
vadorovsky added a commit to vadorovsky/bpf-linker that referenced this pull request Mar 20, 2023
Rust recently updated to LLVM 16 (rust-lang/rust#107224) and the change
is likely to be provided in next nightly builds.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Mar 21, 2023
…ce, r=eholk

move Option::as_slice to intrinsic

`@scottmcm` suggested on rust-lang#109095 I use a direct approach of unpacking the operation in MIR lowering, so here's the implementation.

cc `@nikic` as this should hopefully unblock rust-lang#107224 (though perhaps other changes to the prior implementation, which I left for bootstrapping, are needed).
@nikic
Copy link
Contributor Author

nikic commented Mar 21, 2023

This is the ABI incompatibility I suspect: https://clang.godbolt.org/z/qbW5a58qv dist-x86_64-linux uses libstdc++ 7.5, which has different std::optional ABI from future versions. So if other builders use a newer GCC version, they end up being incompatible with the built libLLVM.so.

Not sure what to do about this. The right way to fix this would probably be to also distribute llvm-wrapper, so that we only link against a C API. But this is probably not a short term solution (I believe llvm-wrapper is currently statically linked in.)

Possibly we could get away with updating the builder to GCC 8, assuming other builders using these artifacts are also on GCC 8 or newer.

@cuviper
Copy link
Member

cuviper commented Mar 21, 2023

That ABI difference is also visible with direct GCC: https://godbolt.org/z/KvPx7En9f, and -Wabi=11 (GCC 7) doesn't warn about it either. I suspect it was gcc commit 447346e or c89f2d2, and llvm/llvm-project#38775 also looks related.

Possibly we could get away with updating the builder to GCC 8, assuming other builders using these artifacts are also on GCC 8 or newer.

I think that's the way to go. AFAICS all the test builders are on at least ubuntu:20.04 which has GCC 9, and all the other crosstool-ng builders are on 8.3.0. It also means that Rust developers using download-ci-llvm will need at least GCC 8, but I think that's fine.

@pnkfelix
Copy link
Member

Visiting for rustc-perf triage

  • instruction count deltas are all over the place
  • cycle counts and wall-time seem to paint this PR in a much more positive light
  • cycle counts regressions: [ +0.67%, +2.92%] +1.88% 22 (9); improvements: [-10.51%, -1.01%] -2.38% 141 (30)
  • wall-time regressions: [ +0.51%, +3.75%] +2.04% 9 (6); improvements: [-10.11%, -0.75%] -2.60% 75 (25)
  • marking as triaged, at least with respect to performance impact.
  • the label doesn't really matter, since it was reverted in PR #109326 anyway

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Mar 21, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 21, 2023
…ce, r=eholk

move Option::as_slice to intrinsic

``@scottmcm`` suggested on rust-lang#109095 I use a direct approach of unpacking the operation in MIR lowering, so here's the implementation.

cc ``@nikic`` as this should hopefully unblock rust-lang#107224 (though perhaps other changes to the prior implementation, which I left for bootstrapping, are needed).
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Mar 22, 2023
…ce, r=eholk

move Option::as_slice to intrinsic

```@scottmcm``` suggested on rust-lang#109095 I use a direct approach of unpacking the operation in MIR lowering, so here's the implementation.

cc ```@nikic``` as this should hopefully unblock rust-lang#107224 (though perhaps other changes to the prior implementation, which I left for bootstrapping, are needed).
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Mar 22, 2023
…ce, r=eholk

move Option::as_slice to intrinsic

````@scottmcm```` suggested on rust-lang#109095 I use a direct approach of unpacking the operation in MIR lowering, so here's the implementation.

cc ````@nikic```` as this should hopefully unblock rust-lang#107224 (though perhaps other changes to the prior implementation, which I left for bootstrapping, are needed).
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 25, 2023
Upgrade to LLVM 16, again

Relative to the previous attempt in rust-lang#107224:
 * Update to GCC 8.5 on dist-x86_64-linux, to avoid std::optional ABI-incompatibility between libstdc++ 7 and 8.
 * Cherry-pick llvm/llvm-project@96df79a.
 * Cherry-pick llvm/llvm-project@6fc670e.

r? `@cuviper`
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 28, 2023
Use llvm 16.0.0 instead of 16.0.0-rc4 for build-clang.sh

Ref: rust-lang#107224

This PR doesn't make any update on LLVM submodule used by Rust repo, but would be super keen to update it, if necessary (https://rustc-dev-guide.rust-lang.org/backend/updating-llvm.html). LLVM 16.0.0 has been [released](https://discourse.llvm.org/t/llvm-16-0-0-release/69326) on March 18, while Rust 1.70 will become stable on June 1.

- https://releases.llvm.org/16.0.0/docs/ReleaseNotes.html
oli-obk pushed a commit to oli-obk/miri that referenced this pull request Apr 4, 2023
Upgrade to LLVM 16, again

Relative to the previous attempt in rust-lang/rust#107224:
 * Update to GCC 8.5 on dist-x86_64-linux, to avoid std::optional ABI-incompatibility between libstdc++ 7 and 8.
 * Cherry-pick llvm/llvm-project@96df79a.
 * Cherry-pick llvm/llvm-project@6fc670e.

r? `@cuviper`
oli-obk pushed a commit to oli-obk/miri that referenced this pull request Apr 4, 2023
Use llvm 16.0.0 instead of 16.0.0-rc4 for build-clang.sh

Ref: rust-lang/rust#107224

This PR doesn't make any update on LLVM submodule used by Rust repo, but would be super keen to update it, if necessary (https://rustc-dev-guide.rust-lang.org/backend/updating-llvm.html). LLVM 16.0.0 has been [released](https://discourse.llvm.org/t/llvm-16-0-0-release/69326) on March 18, while Rust 1.70 will become stable on June 1.

- https://releases.llvm.org/16.0.0/docs/ReleaseNotes.html
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 20, 2024
Update host compiler to LLVM 16

Update the host compiler for dist-x86_64-linux to LLVM 16. In particular, this pulls in llvm/llvm-project@1de305d, which is needed to update Rust's own LLVM (rust-lang/rust#107224).
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 27, 2024
Update host compiler to LLVM 16

Update the host compiler for dist-x86_64-linux to LLVM 16. In particular, this pulls in llvm/llvm-project@1de305d, which is needed to update Rust's own LLVM (rust-lang/rust#107224).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.