aaronpuchert wrote:

> Does this have measurable performance impacts? Or was there some other 
> benefit driving the change?

Thread Safety Analysis is not very expensive overall. I just benchmarked 
compilation of `clang/test/SemaCXX/warn-thread-safety-analysis.cpp` and it 
comes out at around 1% of the overall compilation time. (Although it is also 
just one analysis of many.) Overall compilation before the change takes 
327,801,317 instructions, and 327,433,878 after the change, according to `perf 
stat -r 100` with an error of 0.01%. Which makes it 0.1% faster, or 10% of the 
time for Thread Safety Analysis. So in that sense it is measurable. Will an end 
user notice? Probably not. (Release build with ThinLTO but shared libs for 
faster recompilation. A production build might behave slightly different. The 
profile showed 15–20% in `ld-linux-x86-64.so.2`.)

But the real motivation was conceptual:
* We analyze one function after the other, so for every function, we create a 
bunch of nodes and then throw them all away. We never throw away old facts 
before we're done with the function. So lifetimes already behave as if we had 
an arena: we allocate a bunch of entries and free everything at the end.
* We already use the arena for TIL expressions referenced by the `FactEntry`s. 
With this change we no longer mix "persistent" allocations and arena 
allocations. Everything lives in the arena, and when we're done we throw the 
arena away.

https://github.com/llvm/llvm-project/pull/149660
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to