[PATCH] Make LLVM profiling thread-safe

Matthew Dempsky matthew at dempsky.org
Thu Jun 27 15:07:41 PDT 2013


On Wed, Jun 26, 2013 at 7:01 PM, Eric Christopher <echristo at gmail.com> wrote:
> Anyone know what other compilers do in this space?

For what it's worth, I checked GCC and found these results:

According to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28441, GCC
uses non-atomic increments.  It looks like both SGI and SUSE were
interested enough in atomic increments to independently implement
similar patches, but it doesn't appear like they ever got committed.

According to http://gcc.gnu.org/ml/gcc-patches/2007-03/msg01008.html,
ICC used to use atomic increments, but later switched to non-atomic
(by default?).

According to http://gcc.gnu.org/ml/gcc-patches/2007-03/msg01031.html,
GCC relies on flow conservation across the control flow graph so they
can optimize away counters and recompute them arithmetically from
other counters later on, and therefore having inaccurate counters can
result in other unexpected values later on (e.g., negative counts).
This sounds a lot like LLVM's OptimalEdgeProfiling, so I expect it has
similar problems.



More information about the llvm-commits mailing list