Open
Description
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 a SourceLocation
) 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 just return SourceLocation()
improves compile times considerably: https://llvm-compile-time-tracker.com/compare.php?from=a71f56d63f569ca0ed543d3d01c684ca6ac7dffd&to=2510892ea46a84a284e0cde9f2a4edae3cdb183d&stat=instructions:u
tl;dr: Up to 15%.
Quick experiment with callgrind
when compiling SemaExpr.cpp
:
We should improve this.