Files
rust/tests
bors eeb94be79a Auto merge of #149366 - cjgillot:gvn-primitive, r=RalfJung
GVN: consider constants of primitive types as deterministic

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/149366)*

GVN separates MIR constants into deterministic and non-deterministic constants. Deterministic constants are defined here as: gives the exact same value each time it is evaluated.

This was mainly useful because of `ConstValue::Slice` that generated an extra `AllocId` each time it appeared in the MIR. That variant has been removed. This is still useful for valtrees that hold references, which generate a fresh `AllocId` for each evaluation.

This PR proposes to consider all constants of primitive type to be deterministic. If a constant of primitive type passes validation, then it does not contain provenance, so we have no risk of having a reference becoming different `AllocId`s. In particular, valtrees only are leaves.

r? @ghost for perf
2026-02-23 06:19:36 +00:00
..
2026-02-22 19:43:57 +00:00
2026-02-22 20:02:56 +00:00
2026-02-22 19:59:25 +01:00
2026-01-30 19:15:24 -05:00
2026-02-20 10:35:52 +01:00