As some of you may be aware, I have been working on a new constant expression interpreter for clang for the past few years.
While I have pushed back a little on other people working on it too much in the past (due to it not being mature enough), I think
we’re getting to a point where others may contribute as well.
I regularly publish the current state regarding clang and libc++ tests at https://tbaederr.github.io/stats/ - so right now
753 tests are failing. Some of those tests are rather large though, so the todo list is actually much longer ![]()
What to do?
In short, you can basically look at the newest log file from GitHub - tbaederr/interp-tests, pick a failing test or wrong output, etc. and fix that.
The longer version is that a lot of the tests are broken due to known limitations, like the missing full implementation of __builtin_constant_p. This is especially true for a lot of libc++ tests. Since I have been working on this for a while, I also might have a few trick on what to do and how to diagose certain problems better.
I don’t have all of those limitations written dow, but the stats website from above lists some of them as <sup> notes on the tests. So if you pick a test, I suggest first talking to me, I might have looked into it in the past and decided to drop it for one reason or another.
Since this entire endeavour is about performance, it’s also useful to pick your favorite project and compile it with -fexperimental-new-constant-interpreter. It will probably fail, in which case you can file a bug (or even better, fix that bug!). But if it doesn’t fail, you can investigate why it is slower with the bytecode interpreter. If it is actually faster than before, you can also report that back so I have a little moment of success.
Then there is documentation - there is currently Constant Interpreter — Clang 22.0.0git documentation, which contains little information, so this is something else one could work on. I have also written a few blog posts with some info, which might or might not be outdated already:
- https://developers.redhat.com/articles/2024/10/21/new-constant-expression-interpreter-clang
- https://developers.redhat.com/articles/2024/10/21/new-constant-expression-interpreter-clang-part-2
- https://developers.redhat.com/articles/2024/10/22/new-constant-expression-interpreter-clang-part-3
Unfortunately I don’t think most of the remaining issues fall into the “good first issue” category, so I’m not filing those as issues on Github.
For any questions or suggestions, I am on here and on Discord and Github of course. I know it’s the weekend right now, so I will probably let this post settle a little.