Commit Graph

3782 Commits

Author SHA1 Message Date
Jonathan Brouwer
7cd747decf Rollup merge of #160023 - antoyo:ssa-indirect-return, r=workingjubilee
Refactor the way cg_ssa handles indirect returns (returns via `sret`) — Take 2

This continues the work that @FractalFir done in rust-lang/rust#144976.

**I managed to make this work, so this confirms the original approach works and is ready to merge.**

r? workingjubilee

(assigning the same reviewer as the original PR)

# The problem

The current way `cg_ssa` handles `PassMode::Indirect` is fundamentally incompatible with the requirements of the GCC backend. This is currently worked around in a very brittle way, that breaks on ARM.

In order to function correctly, `cg_gcc` requires the `sret`(indirect return) pointer to be treated in a special way.

# The solution

This PR separates the `sret` pointer from all the other arguments, allowing each backend to decide how it wants to handle that pointer. This will allow GCC to do it's own thing, while changing nothing on the LLVM side. Currently, the PR just makes both backends preappend the sret arg, mimicking the previous behaviour.

The PR is based on this [zulip suggestion](https://rust-lang.zulipchat.com/#narrow/channel/421156-gsoc/topic/Project.3A.20Bootstrap.20of.20rustc.20with.20rustc_codegen_gcc/near/526487725).

# Assumptions I made.

The PR makes certain assumptions about the ABI handling.

1. No LLVM intrinsic returns via sret. [According to my sources](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Can.20LLVM.20intrinsics.20return.20via.20PassMode.3A.3AIndirect.3F), this is always true.
2. Tail calls don't currently return via `sret`. From [asking about](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Can.20tail.20calls.20return.20indirectly.28via.20a.20pointer.29.3F/near/532984507), it seems like the tail call handling does not currently support indirect returns. So, I did not add support for that.
3. TLS shims don't perform indirect returns, and asserts and drops also don't perform indirect returns(since they return nothing) - those assumptions seemed reasonable.
4. Inline assembly calls don't use indirect returns. I *assumed* functions like `inline_asm_call` will not need the `sret` handling code. I am not 100% sure about this, tough.
2026-09-11 12:45:02 +02:00
bjorn3
052ee70292 Don't rely on codegen emitting fn_abi_of_* errors in abi checks
This avoids a delayed bug if compilation is aborted between checking
function ABIs and codegening all functions.
2026-09-10 09:40:28 +02:00
Antoni Boucher
7d0d2731ee Add missing direct return arguments 2026-09-09 12:00:22 -04:00
Antoni Boucher
d244854ed7 Address review 2026-09-09 11:29:12 -04:00
Antoni Boucher
a714a9e8df Improve the new indirect return API 2026-09-09 11:29:11 -04:00
Antoni Boucher
43965ead44 Add missing indirect return argument to new calls 2026-09-09 11:28:44 -04:00
FractalFir
e6b7dc8152 Ported cg_gcc to the new cg_ssa version 2026-09-09 11:14:31 -04:00
FractalFir
cca9f306f0 Refactored the handling of the indirect return pointer in cg_ssa to allow for more correct ABI handling in cg_gcc 2026-09-09 11:14:31 -04:00
bjorn3
54b751d55a Remove emit_almost_fatal
A fatal error that doesn't actually abort is indistinguishable from a
regular error. And the only places where emit_almost_fatal is called,
the produced FatalError is ignored.
2026-09-09 14:03:57 +02:00
Jonathan Brouwer
16f306cb78 Rollup merge of #162309 - sgasho:offload-clang-linker-wrapper, r=ZuseZ4
offload: automate manual clang-linker-wrapper step

automate manual clang-linker-wrapper step from https://rustc-dev-guide.rust-lang.org/offload/usage.html
extract bitcode from device.bin and then wraps it into the host module.
needs some refactoring.

r? @ZuseZ4
2026-09-08 18:19:36 +02:00
Jonathan Brouwer
5a02fc4b88 Rollup merge of #162438 - RalfJung:llvm-minmax, r=nikic
codegen_llvm: use minimum/maximum intrinsics now that they got fixed

r? @nikic
2026-09-07 21:27:58 +02:00
sgasho
ff680e2717 compile device image without adding extra binaries 2026-09-07 17:49:16 +00:00
Ralf Jung
e30341f2c2 codegen_llvm: use minimum/maximum intrinsics now that they got fixed 2026-09-07 18:43:25 +02:00
Jonathan Brouwer
f04af2086f Rollup merge of #160197 - susitsm:restrict-inline-asm-cookies, r=petrochenkov
Restrict LLVM inline asm location cookie usage. Fixes #150451

The parallel frontend makes the cookies nondeterministic in their current form, resulting in nondeterministic outputs when bitcode is emitted or LTO is used.

Causes minor diagnostic regression for inline asm in release builds. See rust-lang/rust#150451 for details.

Fixes rust-lang/rust#150451

r? bjorn3
2026-09-07 17:08:07 +02:00
sgasho
18ada5c34d compile bitcode in device.bin beforehand in order to avoid LLVM JIT, which causes Unable to find target error 2026-09-06 13:31:35 +00:00
Zalathar
de8e5d755a Remove CoverageKind::SpanMarker
Now that we have a span for every HIR expression, we don't need these markers.
2026-09-06 10:24:48 +10:00
Zalathar
436bc15d57 Add CoverageKind::Point
This variant will be used for marker statements that are injected when a HIR
expression is about to be lowered to MIR, and at other points relevant to
coverage instrumentation.

Adding this variant in its own commit keeps the mundane plumbing steps separate
from later changes that will perform injection and analysis.
2026-09-06 10:24:48 +10:00
Matyas Susits
970cb98f0e Disable inline asm line info cookies when llvm bitcode is saved or LTO is enabled
The parallel frontend makes the cookies nondeterministic in their
current form, resulting in nondeterministic outputs when bitcode is
emitted or LTO is used.

Causes minor diagnostic regression for inline asm in release builds.
2026-09-05 11:52:40 +02:00
sgasho
c321d90e6f offload: automate manual clang-linker-wrapper step 2026-09-04 16:59:41 +00:00
Amanieu d'Antras
51b3f52eab Merge zreg into vreg and keep ffr in a clobber-only class 2026-09-04 13:29:17 +00:00
Reuben Cruise
7b2bfecd72 Adds support for AArch64 SVE to inline assembly
Adds new `zreg` register type and `SveVec*` variants to `InlineAsmType`
2026-09-04 13:29:17 +00:00
Jonathan Brouwer
a63c406423 Rollup merge of #160660 - folkertdev:sparc-va-arg, r=saethlin
c-variadic: use `emit_ptr_va_arg` for `va_arg` on `sparc`

I've built GCC for the target and validated pretty extensively that this works. Using our helper does generate worse code for `i64` unfortunately, I've reported that as https://github.com/llvm/llvm-project/issues/214594. But, given that this is a tier-3 target etc. I don't think it makes sense to go out of our way to do better, we can just wait for LLVM to resolve that issue.
2026-09-04 09:44:45 +02:00
Jonathan Brouwer
f0fd2caeeb Rollup merge of #157808 - 1c3t3a:sanitizer-ignorelist, r=rcvalle
sanitizers: Implement support for the sanitize ignorelist

The sanitize ignorelist gives central controls over which functions, files, etc. should be ignored and not sanitized. It is a common file format for clang and explained here:
https://clang.llvm.org/docs/SanitizerSpecialCaseList.html. This change adds support for this list in Rust as well.

r? @rcvalle
2026-09-04 09:44:44 +02:00
Folkert de Vries
fda15d9a67 c-variadic: use emit_ptr_va_arg for va_arg on sparc 2026-09-03 19:13:52 +02:00
Bastian Kersting
c0e55d66cc sanitizers: Implement support for the sanitize ignorelist
The sanitize ignorelist gives central controls over which functions,
files, etc. should be ignored and not sanitized. It is a common file
format for clang and explained here:
https://clang.llvm.org/docs/SanitizerSpecialCaseList.html. This change
adds support for this list in Rust as well.
2026-09-03 15:53:04 +00:00
Jonathan Brouwer
f963b51de8 Rollup merge of #162171 - heiher:loong-f16-nan-box, r=folkertdev
Explain LoongArch f16 NaN-boxing in inline asm

The psABI leaves the upper bits of a widened f16 value undefined, so the NaN-boxing here isn't ABI-required. It's intentional: it matches LLVM's own codegen and avoids an f16 value being mistaken for a valid f32 value. Update the comment to reflect this.

r? @folkertdev
2026-09-03 12:43:13 +02:00
Jonathan Brouwer
79ed850831 Rollup merge of #162153 - cuviper:llvm-get-version, r=wesleywiser
Prefer `LLVMGetVersion` for runtime info

Our `LLVMRustVersion*` functions get hard-coded `LLVM_VERSION_*` values
when we build `RustWrapper.cpp`, but this could be different than the
actual LLVM library at runtime. This should never happen with toolchains
from `rustup`, but with external LLVM in a distro build, for example,
`rustc` and `LLVM` can be upgraded independently.

Most of the time when we check the LLVM version, we're only looking at
the major version anyway, and we already assert that these are equal in
`configure_llvm`. However, for anything that does check the minor or
patch version too, the runtime version is probably more relevant.
2026-09-03 12:43:11 +02:00
Jonathan Brouwer
03f483a782 Rollup merge of #161135 - beetrees:f16-f128-inline-asm-powerpc, r=folkertdev
Add `f16` and `f128` inline ASM support for PowerPC

This PR adds support for `f16`, `f128` and `f16x8` in PowerPC inline ASM vector registers ([PowerPC ISA](https://files.openpowerfoundation.org/s/AKX2KtLkwCXxEaC)).

Ping target maintainers: @daltenty @gilamn5tr @amy-kwan @Gelbpunkt @famfo @neuschaefer

Tracking issue: rust-lang/rust#125398 (part of rust-lang/rust#116909)
2026-09-03 12:43:05 +02:00
Jonathan Brouwer
c720f58385 Rollup merge of #162044 - Zalathar:resolved, r=folkertdev
coverage: Resolve spans to file-coordinates in a separate step

One of the key tasks in coverage codegen is to take the source-code spans that were recorded during MIR instrumentation, and resolve them to physical coordinates in their respective files.

In rare cases this resolution can fail, which leads to the awkward possibility that a function might lose _all_ of its mappings for a particular file/expansion. If that happens, we need to avoid emitting a covfun file section containing no regions, because doing so would trigger errors in LLVM.

The existing code does handle this edge case, but in a way that won't generalise to multiple files/expansions. Having an explicit intermediate resolution step will make it easier to add support for expansion regions in the future.

There should be no change to compiler output.
2026-09-03 12:42:58 +02:00
Ralf Jung
ece2980246 volatile: allow accesses to trap 2026-09-02 14:46:04 +02:00
WANG Rui
67bf3ebc32 Explain LoongArch f16 NaN-boxing in inline asm
The psABI leaves the upper bits of a widened f16 value undefined, so
the NaN-boxing here isn't ABI-required. It's intentional: it matches
LLVM's own codegen and avoids an f16 value being mistaken for a valid
f32 value. Update the comment to reflect this.
2026-09-02 14:26:31 +08:00
Josh Stone
1d08a6b9ff Prefer LLVMGetVersion for runtime info
Our `LLVMRustVersion*` functions get hard-coded `LLVM_VERSION_*` values
when we build `RustWrapper.cpp`, but this could be different than the
actual LLVM library at runtime. This should never happen with toolchains
from `rustup`, but with external LLVM in a distro build, for example,
`rustc` and `LLVM` can be upgraded independently.

Most of the time when we check the LLVM version, we're only looking at
the major version anyway, and we already assert that these are equal in
`configure_llvm`. However, for anything that does check the minor or
patch version too, the runtime version is probably more relevant.
2026-09-01 12:49:07 -07:00
Jonathan Brouwer
bcaa514284 Rollup merge of #162097 - mejrs:instrumentfnattr, r=JonathanBrouwer
Deduplicate `InstrumentFnAttr`

cc @pmur

Instead of having a `Default` variant (which can't be specified in the attribute, it only does on/off), use an Option to model "no attribute used".
2026-09-01 13:27:46 +02:00
Jonathan Brouwer
f9090000f4 Rollup merge of #160989 - N1ark:08-12-generic-float-intrinsincs, r=folkertdev
Make sin, cos, exp, exp2, log, log2, log10 generic

Rebased and smaller version of rust-lang/rust#153934

Following `fabs`, make the `sin`, `cos`, `exp`, `exp2`, `log`, `log2` and `log10` intrinsics generic over the float type, rather than having four variants per float type.

The first two commits are purely stylistic:
- reorganised Cranelift code to make following changes simpler
- moved a misplaced comment in `compiler/rustc_codegen_llvm/src/intrinsic.rs` that caused `x fmt` to give up

The last commit actually makes them generic! Most code is a bit simpler, ~~and this will also hopefully simplify adding support for these intrinsics for the future [`bf16` type](https://github.com/rust-lang/rust/pull/160859)~~ :)

Unfortunately both GCC and Cranelift backend changes are a bit churny. Their code is a bit, opaque, to put it kindly, and I didn't want to refactor those here.

r? @folkertdev
cc @RalfJung
2026-09-01 13:27:38 +02:00
Jonathan Brouwer
1aeb21ba42 Rollup merge of #137720 - folkertdev:naked-function-target-feature, r=Amanieu
support `#[target_feature(enable = ...)]` on `#[naked]` functions

fixes https://github.com/rust-lang/rust/issues/136280

Instructions that are part of a target feature require a special directive on some targets. This PR adds those for the most common targets.

This is very WIP, but I'm hoping to collect some feedback on what is (not) supported and how to report that to users.

r? @ghost

cc @taiki-e @Amanieu
2026-09-01 13:27:35 +02:00
mejrs
8717cbaa84 Deduplicate InstrumentFnAttr 2026-08-31 20:48:05 +02:00
N1ark
edcae4441d Make sin, cos, exp, exp2, log, log2, log10 generic 2026-08-31 18:57:54 +01:00
N1ark
b95e309485 Fix misplaced comment 2026-08-31 18:57:53 +01:00
bors
45f215f136 Auto merge of #162046 - jhpratt:rollup-mIDSgO6, r=jhpratt
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#161301 (libcore: expose volatile atomic operations)
 - rust-lang/rust#161379 (Use better generic type parameter names for `Extend` and `FromIterator`)
 - rust-lang/rust#161926 (borrowck: Restore alias rigidity from HIR typeck)
 - rust-lang/rust#161956 (Remove unused `perform_locally_with_next_solver`)
 - rust-lang/rust#162026 (Emit delayed bug instead of ICEing when `TypeOutlives` goal fails)
 - rust-lang/rust#162034 (Make the LLVM version mismatch ICE a fatal error)
 - rust-lang/rust#162037 (LLVM wrapper cleanups)
 - rust-lang/rust#162043 (_ an unused parameter)
2026-08-31 07:55:09 +00:00
Zalathar
be8a828aa9 Resolve spans to file-coordinates in a separate step
One of the key tasks in coverage codegen is to take the source-code spans that
were recorded during MIR instrumentation, and resolve them to physical
coordinates in their respective files.

In rare cases this resolution can fail, which leads to the awkward possibility
that a function might lose _all_ of its mappings for a particular
file/expansion. If that happens, we need to avoid emitting a covfun file
section containing no regions, because doing so would trigger errors in LLVM.

The existing code does handle this edge case, but in a way that won't
generalise to multiple files/expansions. Having an explicit intermediate
resolution step will make it easier to add support for expansion regions in the
future.
2026-08-31 16:03:23 +10:00
Zalathar
1c44402056 Preliminary cleanup in coverage codegen
- Rename `generate_*` functions to `emit_*`, since they emit LLVM globals
- Consistently use qualified paths in `counter_for_term`
- Remove an unnecessary Clone from `llvm_cov::Regions`
2026-08-31 15:41:06 +10:00
bors
be4b6a99a3 Auto merge of #161081 - scottmcm:min-max-intrinsics, r=clarfonthey
Add intrinsics for integer minimum and maximum



I got inspired to do this when looking at `SliceOrd::compare` where I was reminded that `if a < b { a } else { b }` isn't great in MIR since it takes 4 BBs.  Looking at the codegen side, it turns out we currently emit [42 lines of LLVM-IR including 4 `alloca`s](https://rust.godbolt.org/z/ha4h4nT3r) for `u16::max` (pre-optimization), which is also unnecessarily bad†.

But both LLVM and Cranelift have dedicated things for min & max:

- https://llvm.org/docs/LangRef.html#llvm-umax-intrinsic
- https://docs.rs/cranelift-codegen/latest/cranelift_codegen/ir/trait.InstBuilder.html#method.smin

so let's just use those directly!

This actually wouldn't have been worth doing originally, but a couple of things have happened to change that:

- Back in 1.0 there was only `cmp::min` & `cmp::max`, so there was no place to actually do this at all, but in 2017 they were added to `Ord` as overridable things https://github.com/rust-lang/rust/issues/25663#issuecomment-325799662
- LLVM originally used icmp+select for these, not a dedicated construct, but then added one and as of 2022 the intrinsic is fully usable https://www.npopov.com/2022/12/20/This-year-in-LLVM-2022.html#integer-minmax-intrinsics
- Before we had intrinsic fallback this would have been more annoying to support everywhere -- GCC, [128-bit numbers on cg_clif](https://github.com/bytecodealliance/wasmtime/issues/13790), CTFE, anything out-of-tree -- but now that we can write the obvious fallback we don't need to worry about that.
- The intrinsic would have helped less when it forced extra BBs and `alloca`s in codegen anyway, but [now](https://github.com/rust-lang/compiler-team/issues/970) we can keep the result in SSA without needing to make it a primitive.

† Admittedly we could clean up the gratuitous badness there without needing an intrinsic, but I like doing the intrinsic anyway because that's the only way to avoid it always being stuck in the non-SSA path from the multi-BB assignments.  Even if we made it inlineable, GVN and such will still just give up on seeing the `x = if a < b { a } else { b }` because it's multiple assignments to the same Local, which is non-ideal for something primitive-like.
2026-08-31 04:41:43 +00:00
Ben Kimock
1d7375898d Make the LLVM version mismatch ICE a fatal error 2026-08-30 20:47:08 -04:00
Folkert de Vries
178eb4b50f attach naked function target features to module assembly 2026-08-31 00:25:34 +02:00
Jonathan Brouwer
6f607f4806 Rollup merge of #161788 - jnkel:check-llvm-version, r=saethlin
Check to ensure we're running against the correct LLVM version

The recent LLVM version bump exposed several cases of mishandling LLVM versions, both in-tree and downstream (rust-lang/rust#161335, rust-lang/rust#161377, rust-lang/rust#161572, rust-lang/rust#162013, https://rust-lang.zulipchat.com/#narrow/channel/122651-general/topic/opt-dist.20pipeline.20failure.20in.20MSYS2.20CI.20when.20compiling.2E.2E.2E/with/619077952).

If the compiler is run against an incompatible LLVM version, the most common failure mode is a segfault within LLVM, often when looking up target information. This is not obvious to debug, so this PR adds an LLVM version check before initializing LLVM so that we can produce a clearer error.

The second commit in this PR performs a `dladdr` lookup to print the path to the LLVM we're using. We already have code to do this for finding the sysroot, which I repurposed. However, I don't mind reverting this if it's too complex/risky.

I would appreciate if someone with permissions could trigger a try build on AIX, Windows, and WASI as the second commit touches platform-specific code that I can't test locally.

Before:

```
error: rustc interrupted by SIGSEGV, printing backtrace
0   librustc_driver-18049a207bb38ba8.dy 0x000000010e09e9b8 _RNvNtCsfNrGi27GPxl_17rustc_driver_impl14signal_handler17print_stack_trace + 140
1   libsystem_platform.dylib            0x0000000184c7d744 _sigtramp + 56
2   libLLVM.dylib                       0x000000011a9e22e0 _ZNK4llvm15MCSubtargetInfo13checkFeaturesENS_9StringRefE + 40
3   librustc_driver-18049a207bb38ba8.dy 0x000000010e44c798 LLVMRustHasFeature + 104
4   librustc_driver-18049a207bb38ba8.dy 0x000000010e3c4e34 _RINvXs0_NtNtNtCsk8HLZXaYIk4_4core4iter8adapters3mapINtB6_3MapINtNtB8_7flatten7FlatMapINtNtB8_6filter6FilterINtNtNtBc_5slice4iter4IterTReNtNtCs79s86CIooN0_12rustc_target15target_features9StabilityRSB28_EENCINvNtCses5MBT5CPFU_17rustc_codegen_ssa15target_features24internal_target_featuresKj2_NCNvNtCsgXm2bqwPj4W_18rustc_codegen_llvm9llvm_util13target_config0NCB4G_s_0E0EIBO_INtNtNtNtCs99cPMl0y5Ob_3std11collections4hash3set8IntoIterB28_ENCNCB3h_s_00ENCB3h_s_0ENCINvXs8_NtCsdLs5ZkLaCXa_9hashbrown3setINtB7v_7HashSetNtNtCsSGoTcZpb2F_10rustc_span6symbol6SymbolNtCs5ZGGmiYplBm_10rustc_hash13FxBuildHasherEINtNtNtBa_6traits7collect6ExtendB8e_E6extendBX_E0ENtNtB9I_8iterator8Iterator4folduNCINvNvBar_8for_each4callTB8e_uENCINvXs1i_NtB7x_3mapINtBbD_7HashMapB8e_uB8V_EIB9E_Bbm_E6extendBN_E0E0EB4K_ + 880
5   librustc_driver-18049a207bb38ba8.dy 0x000000010e2ad884 _RINvXs1i_NtCsdLs5ZkLaCXa_9hashbrown3mapINtB7_7HashMapNtNtCsSGoTcZpb2F_10rustc_span6symbol6SymboluNtCs5ZGGmiYplBm_10rustc_hash13FxBuildHasherEINtNtNtNtCsk8HLZXaYIk4_4core4iter6traits7collect6ExtendTBP_uEE6extendINtNtNtB2m_8adapters3map3MapINtNtB3r_7flatten7FlatMapINtNtB3r_6filter6FilterINtNtNtB2o_5slice4iter4IterTReNtNtCs79s86CIooN0_12rustc_target15target_features9StabilityRSB52_EENCINvNtCses5MBT5CPFU_17rustc_codegen_ssa15target_features24internal_target_featuresKj2_NCNvNtCsgXm2bqwPj4W_18rustc_codegen_llvm9llvm_util13target_config0NCB7A_s_0E0EIB3n_INtNtNtNtCs99cPMl0y5Ob_3std11collections4hash3set8IntoIterB52_ENCNCB6b_s_00ENCB6b_s_0ENCINvXs8_NtB9_3setINtBaq_7HashSetBP_B1x_EIB2g_BP_E6extendB3O_E0EEB7E_ + 344
6   librustc_driver-18049a207bb38ba8.dy 0x000000010e2b1ec4 _RINvXs8_NtCsdLs5ZkLaCXa_9hashbrown3setINtB6_7HashSetNtNtCsSGoTcZpb2F_10rustc_span6symbol6SymbolNtCs5ZGGmiYplBm_10rustc_hash13FxBuildHasherEINtNtNtNtCsk8HLZXaYIk4_4core4iter6traits7collect6ExtendBO_E6extendINtNtNtB2k_8adapters7flatten7FlatMapINtNtB3m_6filter6FilterINtNtNtB2m_5slice4iter4IterTReNtNtCs79s86CIooN0_12rustc_target15target_features9StabilityRSB4G_EENCINvNtCses5MBT5CPFU_17rustc_codegen_ssa15target_features24internal_target_featuresKj2_NCNvNtCsgXm2bqwPj4W_18rustc_codegen_llvm9llvm_util13target_config0NCB7e_s_0E0EINtNtB3m_3map3MapINtNtNtNtCs99cPMl0y5Ob_3std11collections4hash3set8IntoIterB4G_ENCNCB5P_s_00ENCB5P_s_0EEB7i_ + 68
7   librustc_driver-18049a207bb38ba8.dy 0x000000010e2bfa90 _RINvNtCses5MBT5CPFU_17rustc_codegen_ssa15target_features24internal_target_featuresKj2_NCNvNtCsgXm2bqwPj4W_18rustc_codegen_llvm9llvm_util13target_config0NCB1o_s_0EB1s_ + 148
8   librustc_driver-18049a207bb38ba8.dy 0x000000010e2fb918 _RNvNtCsgXm2bqwPj4W_18rustc_codegen_llvm9llvm_util13target_config + 68
9   librustc_driver-18049a207bb38ba8.dy 0x000000010e292fb0 _RNvNtCs6x0lOIkloew_15rustc_interface4util17add_configuration + 48
10  librustc_driver-18049a207bb38ba8.dy 0x000000010e06b204 _RINvMs_Csfkr8sXZt4uY_10scoped_tlsINtB5_9ScopedKeyNtCsSGoTcZpb2F_10rustc_span14SessionGlobalsE3setNCNCNCINvNtCs6x0lOIkloew_15rustc_interface4util26run_in_thread_with_globalsNCINvB1G_31run_in_thread_pool_with_globalsNCINvNtB1I_9interface12run_compileruNCNvCsfNrGi27GPxl_17rustc_driver_impl12run_compiler0Es0_0uE0uE000uEB44_ + 1112
11  librustc_driver-18049a207bb38ba8.dy 0x000000010e090914 _RINvCsSGoTcZpb2F_10rustc_span27create_session_globals_thenuNCNCNCINvNtCs6x0lOIkloew_15rustc_interface4util26run_in_thread_with_globalsNCINvB14_31run_in_thread_pool_with_globalsNCINvNtB16_9interface12run_compileruNCNvCsfNrGi27GPxl_17rustc_driver_impl12run_compiler0Es0_0uE0uE000EB3s_ + 168
12  librustc_driver-18049a207bb38ba8.dy 0x000000010e07823c _RINvNtNtCs99cPMl0y5Ob_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCs6x0lOIkloew_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCsfNrGi27GPxl_17rustc_driver_impl12run_compiler0Es0_0uE0uE00uEB3C_ + 112
13  librustc_driver-18049a207bb38ba8.dy 0x000000010e04efa4 _RNSNvYNCINvNtNtCs99cPMl0y5Ob_3std6thread9lifecycle15spawn_uncheckedNCNCINvNtCs6x0lOIkloew_15rustc_interface4util26run_in_thread_with_globalsNCINvB1a_31run_in_thread_pool_with_globalsNCINvNtB1c_9interface12run_compileruNCNvCsfNrGi27GPxl_17rustc_driver_impl12run_compiler0Es0_0uE0uE00uEs_0INtNtNtCsk8HLZXaYIk4_4core3ops8function6FnOnceuE9call_once6vtableB3y_ + 208
14  librustc_driver-18049a207bb38ba8.dy 0x0000000111697118 _RNvNvMs0_NtNtNtCs99cPMl0y5Ob_3std3sys6thread4unixNtB7_6Thread3new12thread_start + 392
15  libsystem_pthread.dylib             0x0000000184c73c58 _pthread_start + 136
16  libsystem_pthread.dylib             0x0000000184c6ec1c thread_start + 8

note: we would appreciate a report at https://github.com/rust-lang/rust
help: you can increase rustc's stack size by setting RUST_MIN_STACK=33554432
```

After:

```
thread 'rustc' (3568488) panicked at compiler/rustc_codegen_llvm/src/llvm_util.rs:59:13:
LLVM version mismatch: this compiler was built for LLVM 23, but LLVM 22.1.8 was found at /Users/keljonathan/code/rust/build/aarch64-apple-darwin/stage0/lib/libLLVM.dylib
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/std/src/panicking.rs:679:5
   1: core::panicking::panic_fmt
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/core/src/panicking.rs:80:14
   2: configure_llvm
             at ./compiler/rustc_codegen_llvm/src/llvm_util.rs:59:13
   3: {closure#0}
             at ./compiler/rustc_codegen_llvm/src/llvm_util.rs:35:13
   4: {closure#0}<rustc_codegen_llvm::llvm_util::init::{closure_env#0}>
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/std/src/sync/once.rs:166:41
   5: <std::sys::sync::once::queue::Once>::call
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/std/src/sys/sync/once/queue.rs:225:21
   6: call_once<rustc_codegen_llvm::llvm_util::init::{closure_env#0}>
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/std/src/sync/once.rs:166:20
   7: init
             at ./compiler/rustc_codegen_llvm/src/llvm_util.rs:34:14
   8: init
             at ./compiler/rustc_codegen_llvm/src/lib.rs:223:9
   9: {closure#2}<(), rustc_driver_impl::run_compiler::{closure_env#0}>
             at ./compiler/rustc_interface/src/interface.rs:440:29
  10: {closure#0}<rustc_interface::interface::run_compiler::{closure_env#2}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>
             at ./compiler/rustc_interface/src/util.rs:223:17
  11: {closure#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#2}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>
             at ./compiler/rustc_interface/src/util.rs:180:24
  12: set<rustc_span::SessionGlobals, rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#2}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()>
             at /Users/keljonathan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/scoped-tls-1.0.1/src/lib.rs:137:9
  13: create_session_globals_then<(), rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#2}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>>
             at ./compiler/rustc_span/src/lib.rs:156:21
  14: {closure#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#2}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>
             at ./compiler/rustc_interface/src/util.rs:176:17
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: the compiler unexpectedly panicked. This is a bug

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/Users/keljonathan/code/rust/rustc-ice-2026-08-25T22_23_11-1423.txt` to your bug report

note: rustc 1.100.0-dev running on aarch64-apple-darwin

note: compiler flags: -C rpath -C debuginfo=0 -Z unstable-options

query stack during panic:
end of query stack
```
2026-08-30 21:48:02 +02:00
Scott McMurray
7519f42401 Add intrinsics for integer minimum and maximum 2026-08-30 00:48:34 -07:00
Zalathar
0bce0415d5 Rename the three main coverage-info structs
- CoverageInfoHi       => CoverageEarlyInfo
- FunctionCoverageInfo => CoverageMirInfo
- CoverageIdsInfo      => CoverageCodegenInfo
2026-08-30 12:23:40 +10:00
Jonathan Brouwer
9dd88ffd5a Rollup merge of #160851 - beetrees:f16-inline-asm-mips, r=folkertdev
Add MSA and `f16` inline ASM support for MIPS

This PR adds vector register support for MIPS inline ASM when using the MSA extension ([MSA specification](https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD00868-1D-MSA64-AFP-01.12.pdf)), as well as adding support for the `f16` type.

Ping target maintainers of MIPS targets: @Itus-Shield @Gelbpunkt @ayrtonm @LukasWoodtli @wzssyqa @chenx97 @709924470 @Cyanoxygen @Fearyncess

Tracking issues:
`f16` inline ASM: rust-lang/rust#125398 (part of rust-lang/rust#116909)
MIPS inline ASM: rust-lang/rust#93335
MIPS target features: rust-lang/rust#150253
2026-08-29 16:13:30 +02:00
beetrees
3c907878d2 Add f16 and f128 inline ASM support for PowerPC 2026-08-29 13:00:58 +01:00
Jacob Pratt
aea48c1edf Rollup merge of #160594 - folkertdev:asm-forward-target-features, r=nikic
attach global target features to module-level assembly

fixes https://github.com/rust-lang/rust/issues/80608
fixes https://github.com/rust-lang/rust/issues/127269

At long last, we can forward global target features to LLVM and it will preserve the target features a block of module-level assembly was defined with through LTO.

cc @nikic (who made this happen)
cc @RalfJung any nasty side-effects we might be overlooking here?
2026-08-29 01:18:51 -04:00