Bump up the LLVM version to 19
This PR adds support for LLVM 19 to diffkemp.
The main differences in comparison to older versions are:
- The removal of comparison of
StringRefwithequalsmethod. We should investigate when was the==operator added and use that instead of some macro and intermediate function. - It seems that some includes regarding the
ModuleandGlobalValuehave changed. It was sufficient to add their includes explicitly. - The
getPredicatemethod was removed fromConstExprand the method that was extracted into a standalone function have many changes (getConstExprAsInstruction).
Note: We do not implement the cmpAPFloats, we should either implement it, or document why not?
Note: We should document the process of adding a new FunctionComparator to the code base, because I have again burned a lot of time on a super simple mistake.
Currently the unit tests fail, this requires a bit of investigation from my side.
@DanielKriz It looks like lowerswitch LLVM optimization pass was renamed to lower-switch [1]. It will need update in https://github.com/diffkemp/diffkemp/blob/8912507d38d3a9591ee55f00a6d7524b204d0255/diffkemp/llvm_ir/optimiser.py#L17
[1] https://github.com/llvm/llvm-project/commit/e390c229a438ed1eb3396df8fbeeda89c49474e6
- The removal of comparison of
StringRefwithequalsmethod. We should investigate when was the==operator added and use that instead of some macro and intermediate function.
It's been supported since at least LLVM 3.0 so let's use it directly.
Note: We do not implement the
cmpAPFloats, we should either implement it, or document why not?
Hm, not sure, probably because kernel (which was our first target) doesn't do FP operations. But we should probably find some benchmark and add it.
Note: We should document the process of adding a new
FunctionComparatorto the code base, because I have again burned a lot of time on a super simple mistake.
That's a great idea.
All right, I think that it is ready for the first true review (at the moment of writing this comment I have pushed some change to the documentation, so the CI might not have passed through yet; however, before that it did).
There are some things regarding commits that I need to discuss:
- I have found out, that I forgot to add LLVM 18 to the list of tested versions in CI, I think that it should be a stand-alone commit, becuause of its "semantics", but it is a fix comment.
- Thanks to the help of @PLukas2018 the tests are now passing, because the Diffkemp now has to support new approach to debug info. It is quite a big change and it has to be squashed to the main LLVM 19 commit, but I want to make this review in separation, before I carefully merge the commit messages.
@viktormalik could you take look on this?
Before looking in detail, I think we should split this a bit more:
- the first two commits can go to a separate PR, along with the last commit
- the docs commit can also go to a separate PR
In addition,
- Thanks to the help of @PLukas2018 the tests are now passing, because the Diffkemp now has to support new approach to debug info. It is quite a big change and it has to be squashed to the main LLVM 19 commit, but I want to make this review in separation, before I carefully merge the commit messages.
This is not true, you can split the LLVM 19 update commit into multiple commits. First, you can do each required change separately (#if LLVM_VERSION_MAJOR >= 19 will just always be false) and as the last commit, you can add "support for LLVM 19" (i.e. new FunctionComparator, CMakeLists.txt changes, and CI jobs).
These splits will make the PR much easier to review.
Thanks!
@viktormalik It should be ready for a review.
The comment is rephased, and it should be ready for a merge @viktormalik .
Great work!