[PATCH] D37248: [XRay][compiler-rt][NFC] Refactor global TLS variables behind an accessor function.

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 29 05:20:50 PDT 2017


dberris added a comment.

Thanks, @eizan

In https://reviews.llvm.org/D37248#855315, @eizan wrote:

> Out of curiosity, why did you make bool Revision 'volatile'? Will it be modified elsewhere?


The recursion guard? That's so that we make sure all the loads and stores are in the same order as they appear in the code.

If we don't use the volatile keyword there, the compiler may be free to elide some of the stores or consolidate them into a single one. Seen this optimisation happen in the wild enough to learn from it. :)


https://reviews.llvm.org/D37248





More information about the llvm-commits mailing list