Skip to content

Update to the latest release/23.x branch - #201

Closed
ColinFinck wants to merge 29 commits into
rust-lang:rustc/23.1-2026-07-22from
ColinFinck:rustc/23.1-2026-07-22
Closed

ColinFinck wants to merge 29 commits into
rust-lang:rustc/23.1-2026-07-22from
ColinFinck:rustc/23.1-2026-07-22

Conversation

@ColinFinck

Copy link
Copy Markdown

This fixes llvm#44560 in particular, which is required for the Rust x86-interrupt calling convention.

dpaoliello and others added 29 commits September 30, 2026 23:28
PR llvm#187290 added a range check of `[0x4000, 0x7fff]` to the
`_ReadStatusReg` and `_WriteStatusReg` builtins. Since `op0 == 2`
registers have bit 14 clear and encode below 0x4000, that check was
incorrect.

This change widens the range back to `[0x0, 0x7fff]` and adds a
regression test.

Fixes llvm#226777

Assisted by: Claude Opus 5 (via VS Code).

(cherry picked from commit 578ddf9)
…lvm#226783)

Consider the following: `or X, (not (not X))`
sinkNotIntoOtherHandOfLogicalOp calls `freelyInvert(X)` but as X is used
in the not this call result in the new instruction is `and (not X), (not
(not X)) -> and (not X), X` instead of the expected `and (not X), (not
X)`

fixes llvm#226504

(cherry picked from commit e3cf335)
llvm#228243)

This fixes a miscompile in performINSERT_VECTOR_ELTCombine dating back
to when it was added (llvm#72675), but only just showing up through testing
when a recent unrelated change triggered vectorisation for a function
that trips it within Clang, leading to broken builds on some of the
two-stage RVV buildbots.

After type legalization the scalar binop can be wider than the vector
element type, with the insert implicitly truncating it. That isn't
equivalent for shifts and a similar bug was found and fixed in a
neighbouring combine in llvm#81168. This patch just applies the same fix
(with the same comment even), avoiding the transform if the scalar type
doesn't match the element type.

I used an LLM to root cause the issue and produce the test case.

(cherry picked from commit 58d59f4)
Handle header-name completion as a special case for replace edits. Its
insert range already extends past the identifier, including delimiters
such as '"' and '>'. Reuse that range for replace edits so that the
insert range remains a prefix of the replace range, as required by the
LSP specification.

Add a unit test covering this case.

Fixes llvm#225326

(cherry picked from commit da43ad3)
We must preserve symbols referenced by the indirect symbol table even
with strip all, and we must preserve symbols referenced by relocations
without strip all.

Fixes: llvm#228595

Assisted-by: codex
(cherry picked from commit feb8b10)
FMAX_A selects an original operand by magnitude and preserves its sign,
so fmax_a(x, x) does not implement fabs. Expand FABS_W and FABS_D to
clear bit 31 and bit 63 with BCLRI, and update their scheduling to match
the bit-clear instructions.

Fixes llvm#228384.

(cherry picked from commit 21970fa)
…#228896)

fixes llvm#228894

The code added in llvm#202496 can
construct an invalid MVT (e.g. a 5-element vector, which is not
something any architecture has a specific register for). So, instead use
an `EVT` which is less restrictive.

(cherry picked from commit 9870703)
…llvm#226713)

Relaxation of pcalau12i+addi (relaxPCHi20Lo12, isInt<22>) and
call36/call30 (relaxMediumCall, isInt<28>) can oscillate: shrinking one
section moves a symbol, which flips isInt<N> for other sites and changes
bytesDropped again.

Follow the same approach as RISCV::relaxCall: after a few passes, do not
allow remove to increase beyond the previous pass's value (cur - delta).
Pass that cap as prevRemove into the two helpers; range checks may still
clear remove (0) when the target goes out of range.

Fixes llvm#226712

(cherry picked from commit 3275789)
…sts (llvm#225445)

As in title. Skipping setting setup/destroy flags caused pseudos to be
wrongly reordered by scheduling

(cherry picked from commit cb474be)
With 23.x we started linking a static libxml in release builds to avoid
requiring that to be installed, and the varying names of that library on
different linux distros. That broke more than it fixed because the
static libxml in our docker images are built targeting ICU, and ICU's
shared library version changes quickly, so even between 2 ubuntu
versions the binaries will not work.

With this change we now build from source in the release build, which is
already what windows does, and we disable ICU / iconv since those don't
seem vital for the windows manifest use case. This seems easier than
building a libxml out of band in our CI images that do the release
builds.

Fixes llvm#215764

Assisted-By: codex
(cherry picked from commit 5ae71ec)
llvm#226791)

__output_buffer::push_back writes a code unit before it makes room, so
the buffer must always have a free one. __copy, __transform and __fill
write in chunks of the available space and could end with the buffer
full. Formatting into a back_insert_iterator of a string, vector or
deque goes through a 256 code unit buffer, so an argument or fill whose
length is a multiple of 256, followed by a literal, wrote that literal
past the end of the buffer.

Make room in a full buffer at the end of these functions, as push_back
does.

Fixes llvm#154670

(cherry picked from commit 372dc97)
Remove IsCommutable from FCULT_W/D and FCULE_W/D, whose predicates are
directional. Extend the existing floating-point comparison tests to
check that reversed comparisons produce separate results.

Fixes: llvm#228422
(cherry picked from commit 321fea5)
Since llvm#179740 `r14` is accepted
as an alias for `lr`, which works on `arm` and `thumb-2` targets, but
not on `thumb-1`

https://godbolt.org/z/WEEjMMj93

```llvm
; -mtriple=thumbv6m-none-eabi
define i32 @read_r14() nounwind {
start:
  %1 = tail call i32 asm sideeffect alignstack "", "=&{r14},~{cc},~{memory}"()
  ret i32 %1
}
```

Gives

```
error: register 'LR' allocated for constraint '{r14}' does not match required type
```

Apparently on `thumb-1` the register class of `lr` is not the same as
the class of `i32`. So, just truly make `{r14}` an alias for `{lr}`.

---

Found via rust-lang/rust#163173.

We should backport this if we can.

(cherry picked from commit b028ea8)
…in ASTReader (llvm#219053)

Fixes a `std::set_difference` sorting violation in
`ASTReader::checkTargetOptions` that causes a crash when building clang
with `LLVM_ENABLE_EXPENSIVE_CHECKS` on libstdc++.

`accumulateFeaturesAsWritten` sorts target features using a custom
comparator that strips the `+`/`-` prefix (i.e. comparing `A.substr(1) <
B.substr(1)`). However, `std::set_difference` was being called with the
default `std::string::operator<` comparator, which does not match the
sorting order because `+` (ASCII 0x2B) is less than `-` (ASCII 0x2D).
For example, `["-cx16", "+sse2"]` is correctly sorted according to the
custom comparator, but incorrectly sorted according to the default
lexicographical comparator.

This patch fixes the issue by passing the same custom comparator used
for sorting to both `std::set_difference` calls.

Fixes llvm#219046.

(cherry picked from commit dc222c2)
…6154)

This is a follow-up to llvm#200732.

Setting the default value of nvptx-allow-ftz-atomics to true preserves
the status quo. It allows the NVPTX backend to emit native
floating-point atomic add instructions by default, rather than falling
back to the CAS loop required for strict FTZ compliance.

Correct FTZ handling forces a lot of existing code to emit CAS loops.
This introduces thread divergence, breaking code that relies on atomic
operations being non-divergent (for example, warp-wide atomic additions
followed by a load of the reduced value without explicit
synchronization).

While FTZ-correct atomic behavior is desirable as a long-term default,
introducing thread divergence into a common operation that previously
"happened to work" without synchronization is highly disruptive.
Defaulting to true makes the FTZ-correct behavior opt-in for now,
allowing users time to audit and adapt their code.

Test cases are updated to verify both enabled and disabled states of the
option, alongside the new default behavior.

(cherry picked from commit 2b6e9d2)
…#226613)

Calling ::close on a Windows SOCKET that has not been converted with
_open_osfhandle crashes and aborts the process with 0xC0000409 instead
of returning an error.

Use ::closesocket on Windows for those sockets, and keep ::close on
POSIX.

(cherry picked from commit d359e9d)
Backport of the TargetLowering part of 975b04b (llvm#213326), which fixes
the "Elements flagged as undef AND zero" assertion in
SimplifyDemandedVectorElts. The computeKnownBits change in that commit is an
optimization and is not needed for the fix. Adds the reproducer from the issue
as a PowerPC test.

Fixes llvm#229620

Assisted-by: Claude Opus 5.5
…ns (llvm#229717)

I have no idea why the code was explicitly written to exclude private
functions; it seems obviously incorrect to me.

(cherry picked from commit 85b4fbf)
…#229002)

PGO instrumentation for selects currently emits an
instrprof.increment.step, where the step is a zext of the select
condition (0 if false, 1 if true). However, if the condition is poison,
then the zext is poison and ends up taking an arbitray, possibly very
large, value, which then gets detected as a corrupted profile.

To avoid this, freeze the condition before extending. A poison select
condition can then add 0 or 1 to the counter, but no other value. I
believe that is the best we can do for poison conditions.

Fixes llvm#228895.

(cherry picked from commit 4810256)
…28959)

MergeFunctions::mergeTwoFunctions may turn identical functions into a
private unnamed function, which trips `assert(F.hasName())`. Without
assertions, all unnamed functions share an empty-name IR comdat (which
yields no ELF section group per MCContext::getELFSection).

Fix llvm#228820: Just drop comdat for unnamed functions. SanitizerCoverage
then retains the metadata sections via `llvm.used`. It's acceptable to
have redundat metadata sections with discarded associated text sections.

(cherry picked from commit 09b7f9f)
…utes.

PR llvm#209345 changed inlining behaviour for 'alwaysinline' functions
when the callee's SME attributes were incompatible with the caller's
SME attributes. This is not desirable, as it would stop small utility
routines being inlined into streaming functions (such as std::max).

This PR restores the original behaviour from before llvm#209345.

For LLVM 24 we intend to solve this in a better way, see llvm#223393.

This addresses llvm#217639
…lvm#213631)

Correctly recognize that a global address does escape when it is stored
into itself. Such globals were previously incorrectly marked as
non-address-taken.

Fixes: llvm#213232.
(cherry picked from commit 2b3dd2d)
…ize (llvm#224029)

emitPrologue pushes a slot to give an error-code handler the
return-address parity the frame layout assumes, but StackSize counted
that push as well. NumBytes derives from StackSize, so the subq grew by
8 too and left RSP at 8 mod 16 at every call. Object addresses are
unchanged.

Fixes llvm#44560, fixes llvm#50195

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit 031866f)
@ColinFinck
ColinFinck requested a review from nikic as a code owner October 12, 2026 19:59
@nikic

nikic commented Oct 13, 2026

Copy link
Copy Markdown

I ended up pushing a slightly newer version with another fix we need.

Corresponding submodule update at rust-lang/rust#164254.

@nikic nikic closed this Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.