Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LGTM aside from some minor points.
clang/lib/AST/Interp/ByteCodeStmtGen.cpp | ||
---|---|---|
361 | What does the call to discard() do? Evaluate the expression and discard the results? (If so, the API might want for a better name at some point, as it can also read like "do nothing with this expression".) | |
clang/test/AST/Interp/loops.cpp | ||
217–227 | I'd love to see a stress test for the compile time performance of: int func() { int i = 0; for (;;) { if (i == __INT_MAX__) break; ++i; } return i; } static_assert(func() == __INT_MAX__); I don't think there's value to testing specifically how long it takes for this to execute, but we should probably start thinking about how to validate performance characteristics pretty soon. Perhaps relative performance compared to the existing constant expression evaluator would be interesting though? | |
272 | Another test to add here: for (;;); is just as infinite. |
clang/lib/AST/Interp/ByteCodeStmtGen.cpp | ||
---|---|---|
361 | Yes, it's the same problem that https://reviews.llvm.org/D136013 tries to solve. If Inc evaluates to a value, it will leave that on the stack and something needs to remove it from there, which is what discard() does. | |
clang/test/AST/Interp/loops.cpp | ||
217–227 |
Definitely. My plan was basically to get some base functionality going and then always keep an eye on performance. Your test doesn't work because the current interpreter has a step limit, but for a simple loop up until 100'000, the current interpreter takes 42s here and the new one takes 2s. |
clang/test/AST/Interp/loops.cpp | ||
---|---|---|
272 | Heh, that's what this was supposed to be :) I already have the while(true) one above. |
What does the call to discard() do? Evaluate the expression and discard the results? (If so, the API might want for a better name at some point, as it can also read like "do nothing with this expression".)