Issue |
135764
|
Summary |
[clang] Expose constexpr evaluation statistics
|
Labels |
clang
|
Assignees |
|
Reporter |
BenBE
|
When compiling constexpr-heavy code it would be nice to receive more feedback than "constexpr evaluation hit maximum step limit" or "constexpr evaluation exceeded maximum depth of N calls". Especially when you do not reach these limits with your code quite yet, getting some feedback, e.g. via the `-ftime-trace` or some other means, how much allowed resources compilation of your code took, would be nice.
In the easiest case, this could mean to publish the evaluation counter for each `EvaluateAsInitializer` call (and similar in the generated time trace log, along-side the maximum depth and the other tracked limits.
If evaluating a constexpr triggered recursively, these sub-expressions could get their own trace too.
```cpp
template <typename T>
struct bar {
static const T v;
};
template <typename T>
const T bar<T>::v = 21*sizeof(T);
template <typename T>
struct foo {
static const T v;
};
template <typename T>
const T foo<T>::v = bar<T>::v;
int main() {
return foo<short>::v;
}
```
A time trace report for the above code would then include the following listing:
```
foo<short>::v (steps=4, depth=2, loops=0)
bar<short>::v (steps=3, depth=1, loops=0)
```
Other alternatives to produce such a report are welcome too.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs