Add LLVM 23 compatibility - #7491
Open
kuvaus wants to merge 3 commits into
Open
Conversation
Collaborator
|
Please look at previous update prs to see what else you need to add. Hint: microarch and optimization updates. |
Author
|
Oh, it became quite a bit more involved than just a couple of lines. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
LLVM 23 was recently released and this PR adds Odin compatibility with the LLVM 23 backend.
In LLVM 23, branching
LLVMBrwas divided into two types:LLVMUncondBrandLLVMCondBr, depending on whether the branching was unconditional or conditional.This PR checks if
LLVM_VERSION_MAJORis 23 or newer and handles both types. The#elseclause also preserves backward compatibility with older LLVM versions.Changes:
In
src/llvm_backend_general.cpp, line 554:In
src/llvm_backend_stmt.cpp, line 2807:LLVM 23 compatibility was also added to
build_odin.sh:Though maybe we could stay in 22 for now.
Testing:
After the small changes above, I successfully built the compiler on Intel macOS using Homebrew's LLVM 23.1.0. I tested using small odin program with
ifclauses (CondBr) and one withfor,whileloops andbreaks (UncondBr). Both test programs worked as they should. I did not do a full test on everything but maybe this PR could serve at least as a starting point for LLVM 23 compatibility.