[llvm] [IPSCCP] Infer attributes on arguments (PR #107114)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 6 08:56:44 PDT 2024
nikic wrote:
Okay, I've tracked down what is happening here. We infer more nonnull attributes, and then based on those determine that some recursive RecursiveASTVisitor::TraverseStmt calls reduce to just a push_back call (https://github.com/llvm/llvm-project/blob/00e40c9b5b1a8208c4f2b785138d79ad0e9107af/clang/include/clang/AST/RecursiveASTVisitor.h#L662) and inline it. This adds a decent chunk of extra code to many methods. An additional effect on top of that is that this allows us to optimize away the `%this` argument on some methods, which means that the recursive calls now no longer have a uniform signature, so we get additional register moves. These effects are extremely amplified because they apply across a very large number of RecursiveASTVisitor methods, which in turn are instantiated a large number of times.
The issue can be added by adding a noinline attribute to this method: https://github.com/llvm/llvm-project/pull/107601
With that done, the compile-time numbers look good: http://llvm-compile-time-tracker.com/compare.php?from=0797c184c636889f2897746dc71390ae28005c7c&to=464036f828c4c9f46f7411a40b49e249e6b47dce&stat=instructions%3Au
https://github.com/llvm/llvm-project/pull/107114
More information about the llvm-commits
mailing list