[PATCH] [X86] replace (atomic fetch_add of 0) by (mfence; mov)

Chandler Carruth chandlerc at gmail.com
Wed Aug 27 15:40:46 PDT 2014

Comment at: lib/Target/X86/X86ISelDAGToDAG.cpp:1748-1751
@@ -1745,1 +1747,6 @@
+// On x86 an atomic load-add of the constant 0 can be replaced by an mfence
+// followed by a mov. An explanation of this (and exemple of why the mfence
+// is required) is available at
+// http://www.hpl.hp.com/techreports/2012/HPL-2012-68.pdf
+// This link also shows how such an operation can be useful for ending some
A general, important comment about implementing these kinds of optimizations: please write out the justification in the comments. Cite the paper for details, but at least lay out the basic ideas. It also would be useful to explain it using the terminology likely to be familiar to another LLVM developer.


More information about the llvm-commits mailing list