Issue |
140876
|
Summary |
`Expr::getExprLoc()` is slow
|
Labels |
slow-compile
|
Assignees |
|
Reporter |
tbaederr
|
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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs