Skip to content

Update LLVM from 14.0.6 to 21.1.2#8737

Merged
csyonghe merged 13 commits intoshader-slang:masterfrom
juliusikkala:update-llvm
Oct 27, 2025
Merged

Update LLVM from 14.0.6 to 21.1.2#8737
csyonghe merged 13 commits intoshader-slang:masterfrom
juliusikkala:update-llvm

Conversation

@juliusikkala
Copy link
Contributor

This PR upgrades slang-llvm to use LLVM 21.1.2. It also fixes the USE_SYSTEM_LLVM option on some Linux distributions (e.g. SUSE and derivatives) which don't ship separate components for LLVM or Clang, and instead just have libLLVM.so and libclang-cpp.so containing all components.

Motivation

I'm working on a direct LLVM IR emitter for Slang. That work is in a fairly good state by now, but I still need to move the emitter into slang-llvm and link to LLVM in the Correct Way instead of whatever garbage I have in that branch right now. The problem with that is that slang-llvm currently links to a comparatively ancient LLVM version. There have been major changes to LLVM since then, and I wrote the emitter for LLVM 20-21. Differences between those two versions are minor and I can downgrade to 20 with little effort if that's better.

@juliusikkala juliusikkala added the pr: non-breaking PRs without breaking changes label Oct 16, 2025
@juliusikkala
Copy link
Contributor Author

The /Zc:preprocessor is needed on MSVC due to llvm/llvm-project#86028.

@juliusikkala juliusikkala marked this pull request as ready for review October 17, 2025 11:37
@juliusikkala juliusikkala requested a review from a team as a code owner October 17, 2025 11:37
Copy link
Contributor

@samestep samestep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing, thank you for doing this! Someone who's more familiar with the code touched here should review this in more detail, but in particular, this would unblock any future efforts to reenable slang-llvm in Nixpkgs since LLVM versions 17 and older were dropped last month: NixOS/nixpkgs#440273 (comment)

I was able to successfully build this locally on x86 NixOS via the following commands in the flake dev shell:

git clean -xdfe .envrc
external/build-llvm.sh --source-dir build/slang-llvm_src --install-prefix build/slang-llvm_install
cmake --preset default --fresh -DSLANG_SLANG_LLVM_FLAVOR=USE_SYSTEM_LLVM -DLLVM_DIR=build/slang-llvm_install/lib/cmake/llvm -DClang_DIR=build/slang-llvm_install/lib/cmake/clang
cmake --build --preset release

@samestep samestep requested a review from a team October 17, 2025 19:53
@csyonghe csyonghe added this pull request to the merge queue Oct 27, 2025
Merged via the queue into shader-slang:master with commit 1f888a3 Oct 27, 2025
38 checks passed
jvepsalainen-nv pushed a commit to jvepsalainen-nv/slang that referenced this pull request Nov 4, 2025
This PR upgrades slang-llvm to use LLVM 21.1.2. It also fixes the
`USE_SYSTEM_LLVM` option on some Linux distributions (e.g. SUSE and
derivatives) which don't ship separate components for LLVM or Clang, and
instead just have `libLLVM.so` and `libclang-cpp.so` containing all
components.

## Motivation

I'm working on a [direct LLVM IR
emitter](https://github.com/juliusikkala/slang/tree/llvm-target) for
Slang. That work is in a fairly good state by now, but I still need to
move the emitter into slang-llvm and link to LLVM in the Correct Way
instead of whatever garbage I have in that branch right now. The problem
with that is that slang-llvm currently links to a comparatively ancient
LLVM version. There have been major changes to LLVM since then, and I
wrote the emitter for LLVM 20-21. Differences between those two versions
are minor and I can downgrade to 20 with little effort if that's better.
juliusikkala added a commit to juliusikkala/slang that referenced this pull request Nov 12, 2025
This PR upgrades slang-llvm to use LLVM 21.1.2. It also fixes the
`USE_SYSTEM_LLVM` option on some Linux distributions (e.g. SUSE and
derivatives) which don't ship separate components for LLVM or Clang, and
instead just have `libLLVM.so` and `libclang-cpp.so` containing all
components.

## Motivation

I'm working on a [direct LLVM IR
emitter](https://github.com/juliusikkala/slang/tree/llvm-target) for
Slang. That work is in a fairly good state by now, but I still need to
move the emitter into slang-llvm and link to LLVM in the Correct Way
instead of whatever garbage I have in that branch right now. The problem
with that is that slang-llvm currently links to a comparatively ancient
LLVM version. There have been major changes to LLVM since then, and I
wrote the emitter for LLVM 20-21. Differences between those two versions
are minor and I can downgrade to 20 with little effort if that's better.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: non-breaking PRs without breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants