aeft wrote: ## Performance Analysis
According to [llvm-compile-time-tracker](https://llvm-compile-time-tracker.com/?config=Overview&stat=instructions%3Au&remote=usx95), this PR introduced 0.85% regression on top of baseline-with-lifetime-safety (which itself adds 1.86% over lifetime-safety-disabled). Many Sema files have significant regression. For example, `SemaExpr.cpp.o` regresses by +11.52%. I profiled clang while compiling `SemaExpr.cpp` on my laptop. Several metrics below. The following table is produced by instrumenting `FactsGenerator::flow`, sampling the `dst` OriginNode tree shape at every top-level entry (Hope this can give a sense of how big these trees can grow): - `depth`: longest path from the root to a leaf - `max_fanout`: largest number of children at any single node - `nodes`: total number of nodes in the tree | | NFC PR | This PR | | --- | ---:| ---:| | flows (top-level) | 160,449 | 155,544 | | max_depth | 3 | 9 | | max_fanout | 1 | 28 | | max_nodes | 3 | 100 | | depth | NFC PR | This PR | | ---:| ---:| ---:| | 1 | 147,745 | 138,033 | | 2 | 12,702 | 12,870 | | 3 | 2 | 2,399 | | 4-6 | 0 | 1,539 | | 7-9 | 0 | 703 | | nodes | NFC PR | This PR | | ---:| ---:| ---:| | 1 | 147,745 | 138,033 | | 2 | 12,702 | 12,711 | | 3 | 2 | 796 | | 4-15 | 0 | 2,315 | | 31 | 0 | 1 | | 46 | 0 | 959 | | 47 | 0 | 12 | | 48 | 0 | 637 | | 49-54 | 0 | 76 | | 99-100 | 0 | 4 | Here, I report the performance of three core methods on `SemaExpr.cpp`: | method | NFC PR | This PR | | --- | ---:| ---:| | flow (top-level) | 3\.01 ms | 4\.60 ms | | getOriginNode | 96\.55 ms | 1712\.11 ms | | hasOrigins | 0\.55 ms | 2\.00 ms | >From the table, the regression is concentrated in `getOriginNode`; `flow` and >`hasOrigins` stay cheap. The regression likely comes from building larger >trees in `getOriginNode`. I'll share more analysis later and look into >optimizing (or bugfix?) `getOriginNode`. This also matches the performance change in `FactGenerator` (as profiled with `-ftime-trace`): | | NFC PR | This PR | delta | | --- | ---:| ---:| ---:| | LifetimeSafetyAnalysis | 0\.269 s | 2\.516 s | \+2.247 s | | FactGenerator | 0\.123 s | 1\.766 s | \+1.644 s | | LiveOrigins | 0\.055 s | 0\.386 s | \+0.331 s | https://github.com/llvm/llvm-project/pull/195603 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
