From 4f7c60edb1be8201c9de8011b99fa904055bc243 Mon Sep 17 00:00:00 2001 From: whispers Date: Wed, 15 Jul 2026 10:25:53 -0400 Subject: [PATCH] llvm_22: pick patch for selectiondag freeze condition miscompile see https://github.com/NixOS/nixpkgs/commit/f8a025c9646e61bc992f4f3d76dd4193d749f417. this commit backports that same change to LLVM 22. the fix is not available upstream since LLVM 22 is EOL, but we can pick the patch from the Rust fork of LLVM, as that is currently on version 22.1. --- .../compilers/llvm/common/llvm/default.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/development/compilers/llvm/common/llvm/default.nix b/pkgs/development/compilers/llvm/common/llvm/default.nix index 2b872a8a45c8..c84539690668 100644 --- a/pkgs/development/compilers/llvm/common/llvm/default.nix +++ b/pkgs/development/compilers/llvm/common/llvm/default.nix @@ -234,6 +234,18 @@ stdenv.mkDerivation ( # LLVM issue: https://github.com/llvm/llvm-project/issues/208611 # LLVM PR: https://github.com/llvm/llvm-project/pull/208683 (getVersionFile "llvm/sdag-freeze-condition-in-select-of-load-fold.patch") + ] + ++ lib.optionals (lib.versions.major release_version == "22") [ + # Same issue and fix as above, for LLVM 22. While LLVM 22 was EOL at + # the time of the LLVM PR, and was thus not backported upstream, the + # backport was made to Rust's LLVM fork on LLVM 22.1. Accordingly, we + # fetch the patch from there. + (fetchpatch { + name = "llvm-22-sdag-freeze-condition-in-select-of-load-fold.patch"; + url = "https://github.com/rust-lang/llvm-project/commit/abcef279cd33492fe8301c8873fc535fa4dbf0d5.patch"; + stripLen = 1; + hash = "sha256-HHVMVL7ZWiZkbfnD37zYxFWnfvI3LNS0Z2oFHhOaZsU="; + }) ]; nativeBuildInputs = [