Output step count for constant expression

I have a function which exceeds default constexpr step limit of clang. I would like to optimize that function, but it is very hard to see whether or not the changes I've made do in fact reduce number of steps per evaluation. I have not found how to see that number for a specific expression, and wanted to see if it is possible to add that feature. It could be a diagnostic, or just a file output.

I've looked a little at ExprConstant.cpp in AST, but there is a lot going on in that file. I've found StepsLeft variable, which tracks how many steps has been executed already, but I'm struggling to understand where constexpr execution begins and ends, and how to output the necessary message. I have literally several hours of experience with the code base and cannot wrap my head around it.

If someone could help out with adding that diagnostic, or provide other ways to get number of execution steps, that would be great.

Nikita Alekseev

You might want to also ask on cfe-dev@lists.llvm.org as it sounds related to Clang.