Skip to content

Fix compatibility with LLVM 23#2951

Merged
wsmoses merged 1 commit into
EnzymeAD:mainfrom
nikic:llvm23-compat
Jul 17, 2026
Merged

Fix compatibility with LLVM 23#2951
wsmoses merged 1 commit into
EnzymeAD:mainfrom
nikic:llvm23-compat

Conversation

@nikic

@nikic nikic commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

OptimizationLevel is an enum now.

Comment thread enzyme/Enzyme/Enzyme.cpp
static InlineParams getInlineParamsFromOptLevel(OptimizationLevel Level) {
#if LLVM_VERSION_MAJOR >= 23
return getInlineParams(Level.getSpeedupLevel());
return getInlineParamsFromOptLevel(static_cast<unsigned>(Level));

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This was previously passing the optimization level to an API accepting an inlining threshold ... so this was effectively setting a very low inlining threshold.

Comment thread enzyme/Enzyme/Enzyme.cpp Outdated
MPM.addPass(InferFunctionAttrsPass());

#if LLVM_VERSION_MAJOR >= 23
if (Level > OptimizationLevel::O1) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we put the { outside the ifdef (so basic code completion tools don't get confused)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done!

@nikic

nikic commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

I updated the commit has in the MLIR test similar to what was done in 7be5247.

The commit has is the last one before LLVM 23 was branched.

@nikic nikic mentioned this pull request Jul 16, 2026
9 tasks
@wsmoses
wsmoses merged commit 6882b79 into EnzymeAD:main Jul 17, 2026
31 checks passed
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jul 24, 2026
Update to LLVM 23



Changes in this PR (apart from the LLVM update):
 * Updated cov-map tests due to minor ordering changes introduced in llvm/llvm-project@5931034. The affected tests are limited to LLVM >= 23 now.
 * Set `LLVM_VERSIONED_DYLIB_NAME_ON_DARWIN=OFF`, which restores the previous unversioned naming of the LLVM dylib on Darwin. I expect we'll want to change this for consistency with Linux, but given the amount of trouble Darwin dylibs have caused in the past, I'm not trying to do it in this PR.
 * Distribute the llvm-project/libc subproject, which is now a build dependency of LLVM.
 * Pull in f128 Windows ABI changes from #158778. These need to land in sync with the LLVM update (as ABI of libcalls is controlled by LLVM, not our ABI lowering).
 * Disable RISCV backend on dist-i686-mingw, because the build OOMs on a large generated file. This is a temporary measure until host tools are removed by rust-lang/compiler-team#1020.
 * The llvm-project fork includes a new downstream patch for mingw: rust-lang/llvm-project@b89cd8e It works around mingw having broken TLS prior to GCC 16. (We're currently on GCC 14.)

Issues:
* [x] llvm/llvm-project#209512
* [x] llvm/llvm-project#209714
* [x] llvm/llvm-project#209718
* [x] rust-lang/stdarch#2190 (synced in #159517)
* [x] llvm/llvm-project#210025
* [x] #159391
* [x] EnzymeAD/Enzyme#2951
* [x] #159301
* [x] llvm/llvm-project#210300
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jul 24, 2026
Update to LLVM 23



Changes in this PR (apart from the LLVM update):
 * Updated cov-map tests due to minor ordering changes introduced in llvm/llvm-project@5931034. The affected tests are limited to LLVM >= 23 now.
 * Set `LLVM_VERSIONED_DYLIB_NAME_ON_DARWIN=OFF`, which restores the previous unversioned naming of the LLVM dylib on Darwin. I expect we'll want to change this for consistency with Linux, but given the amount of trouble Darwin dylibs have caused in the past, I'm not trying to do it in this PR.
 * Distribute the llvm-project/libc subproject, which is now a build dependency of LLVM.
 * Pull in f128 Windows ABI changes from #158778. These need to land in sync with the LLVM update (as ABI of libcalls is controlled by LLVM, not our ABI lowering).
 * Disable RISCV backend on dist-i686-mingw, because the build OOMs on a large generated file. This is a temporary measure until host tools are removed by rust-lang/compiler-team#1020.
 * The llvm-project fork includes a new downstream patch for mingw: rust-lang/llvm-project@b89cd8e It works around mingw having broken TLS prior to GCC 16. (We're currently on GCC 14.)

Issues:
* [x] llvm/llvm-project#209512
* [x] llvm/llvm-project#209714
* [x] llvm/llvm-project#209718
* [x] rust-lang/stdarch#2190 (synced in #159517)
* [x] llvm/llvm-project#210025
* [x] #159391
* [x] EnzymeAD/Enzyme#2951
* [x] #159301
* [x] llvm/llvm-project#210300
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jul 25, 2026
Update to LLVM 23



Changes in this PR (apart from the LLVM update):
 * Updated cov-map tests due to minor ordering changes introduced in llvm/llvm-project@5931034. The affected tests are limited to LLVM >= 23 now.
 * Set `LLVM_VERSIONED_DYLIB_NAME_ON_DARWIN=OFF`, which restores the previous unversioned naming of the LLVM dylib on Darwin. I expect we'll want to change this for consistency with Linux, but given the amount of trouble Darwin dylibs have caused in the past, I'm not trying to do it in this PR.
 * Distribute the llvm-project/libc subproject, which is now a build dependency of LLVM.
 * Pull in f128 Windows ABI changes from #158778. These need to land in sync with the LLVM update (as ABI of libcalls is controlled by LLVM, not our ABI lowering).
 * Disable RISCV backend on dist-i686-mingw, because the build OOMs on a large generated file. This is a temporary measure until host tools are removed by rust-lang/compiler-team#1020.
 * The llvm-project fork includes a new downstream patch for mingw: rust-lang/llvm-project@b89cd8e It works around mingw having broken TLS prior to GCC 16. (We're currently on GCC 14.)

Issues:
* [x] llvm/llvm-project#209512
* [x] llvm/llvm-project#209714
* [x] llvm/llvm-project#209718
* [x] rust-lang/stdarch#2190 (synced in #159517)
* [x] llvm/llvm-project#210025
* [x] #159391
* [x] EnzymeAD/Enzyme#2951
* [x] #159301
* [x] llvm/llvm-project#210300
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jul 25, 2026
Update to LLVM 23



Changes in this PR (apart from the LLVM update):
 * Updated cov-map tests due to minor ordering changes introduced in llvm/llvm-project@5931034. The affected tests are limited to LLVM >= 23 now.
 * Set `LLVM_VERSIONED_DYLIB_NAME_ON_DARWIN=OFF`, which restores the previous unversioned naming of the LLVM dylib on Darwin. I expect we'll want to change this for consistency with Linux, but given the amount of trouble Darwin dylibs have caused in the past, I'm not trying to do it in this PR.
 * Distribute the llvm-project/libc subproject, which is now a build dependency of LLVM.
 * Pull in f128 Windows ABI changes from #158778. These need to land in sync with the LLVM update (as ABI of libcalls is controlled by LLVM, not our ABI lowering).
 * Disable RISCV backend on dist-i686-mingw, because the build OOMs on a large generated file. This is a temporary measure until host tools are removed by rust-lang/compiler-team#1020.
 * The llvm-project fork includes a new downstream patch for mingw: rust-lang/llvm-project@b89cd8e It works around mingw having broken TLS prior to GCC 16. (We're currently on GCC 14.)

Issues:
* [x] llvm/llvm-project#209512
* [x] llvm/llvm-project#209714
* [x] llvm/llvm-project#209718
* [x] rust-lang/stdarch#2190 (synced in #159517)
* [x] llvm/llvm-project#210025
* [x] #159391
* [x] EnzymeAD/Enzyme#2951
* [x] #159301
* [x] llvm/llvm-project#210300
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jul 25, 2026
Update to LLVM 23



Changes in this PR (apart from the LLVM update):
 * Updated cov-map tests due to minor ordering changes introduced in llvm/llvm-project@5931034. The affected tests are limited to LLVM >= 23 now.
 * Set `LLVM_VERSIONED_DYLIB_NAME_ON_DARWIN=OFF`, which restores the previous unversioned naming of the LLVM dylib on Darwin. I expect we'll want to change this for consistency with Linux, but given the amount of trouble Darwin dylibs have caused in the past, I'm not trying to do it in this PR.
 * Distribute the llvm-project/libc subproject, which is now a build dependency of LLVM.
 * Pull in f128 Windows ABI changes from #158778. These need to land in sync with the LLVM update (as ABI of libcalls is controlled by LLVM, not our ABI lowering).
 * Disable RISCV backend on dist-i686-mingw, because the build OOMs on a large generated file. This is a temporary measure until host tools are removed by rust-lang/compiler-team#1020.
 * The llvm-project fork includes a new downstream patch for mingw: rust-lang/llvm-project@b89cd8e It works around mingw having broken TLS prior to GCC 16. (We're currently on GCC 14.)

Issues:
* [x] llvm/llvm-project#209512
* [x] llvm/llvm-project#209714
* [x] llvm/llvm-project#209718
* [x] rust-lang/stdarch#2190 (synced in #159517)
* [x] llvm/llvm-project#210025
* [x] #159391
* [x] EnzymeAD/Enzyme#2951
* [x] #159301
* [x] llvm/llvm-project#210300
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.

2 participants