-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Expr::getExprLoc()
is slow
#140876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-clang-frontend Author: Timm Baeder (tbaederr)
This first came up when the implementation of `CallExpr::getBeginLoc()` was changed and we saw a surprising drop in compile times.
We call Changing the implementation of tl;dr: Up to 15%. Quick experiment with We should improve this. |
I wonder if we can have a bit in CallExprBitfields to track whether the callee is an ExplicitObjectMemberFunction, so that we can get rid of the call to getCalleeDecl |
@zyn0217 If it helps, sure :) But I don't know how easy it is to track that from construction. I wonder if we can find a better way to handle/remove the special case for explicit object member functions |
I'm trying a few different things Nowhere near 10% though |
For what it's worth, this is the reason why the code in We could generalize the approach there, and create an |
This first came up when the implementation of
CallExpr::getBeginLoc()
was changed and we saw a surprising drop in compile times.We call
Expr::getExprLoc()
(and various other functions returning aSourceLocation
) all the time. The assumption is that the call is cheap and that it's fine to do even if the source location isn't used in the end.Changing the implementation of
Expr::getExprLoc()
to justreturn SourceLocation()
improves compile times considerably: https://llvm-compile-time-tracker.com/compare.php?from=a71f56d63f569ca0ed543d3d01c684ca6ac7dffd&to=2510892ea46a84a284e0cde9f2a4edae3cdb183d&stat=instructions:utl;dr: Up to 15%.
Quick experiment with
callgrind
when compilingSemaExpr.cpp
:We should improve this.
The text was updated successfully, but these errors were encountered: