[clang] [clang-tools-extra] [clang] Compute accurate begin location for CallExpr with explicit object parameter (PR #117841)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 7 16:42:05 PST 2024


HighCommander4 wrote:

> It looks like this causes a significant compile-time regression: https://llvm-compile-time-tracker.com/compare.php?from=2b855dd97092e2178ac5c470a804a17ec440d7e5&to=9ccde12f5eeb91152900082a2ae839e2a9702b31&stat=instructions:u (Maybe most clearly seen during clang bootstrap, where this adds 0.5% to many compilations: https://llvm-compile-time-tracker.com/compare_clang.php?from=2b855dd97092e2178ac5c470a804a17ec440d7e5&to=9ccde12f5eeb91152900082a2ae839e2a9702b31&stat=instructions%3Au&sortBy=interestingness)
> 
> Is that expected?

I think it's at least conceivable, as the patch adds an extra branch to `CallExpr::getBeginLoc()`, which is likely to be called pretty frequently.

The branch is **not** taken most of the time (it's only taken for calls to functions with an explicit object argument, which is a C++23 feature), so perhaps annotating the branch as "unlikely" is sufficient to avoid the performance regression?

https://github.com/llvm/llvm-project/pull/117841


More information about the cfe-commits mailing list