This patch against LLVM (applies against svn repository of october 27, 12.19 pm), implements the optimisation described in Morisset, Zappa Nardelli Partially Redundant Fence Elimination for x86, ARM and Power processors and adds the following option to Clang+LLVM: -disable-fences-pre : disables the new optimisation pass For benchmark purposes, the patch also implements the following options: -make-all-atomic-accesses-seq-cst : consider all atomic access as seq_cst -add-mfence-after-atomic-stores : transform atomic stores in mov; mfence -add-mfence-before-atomic-loads : transform atomic loads in mfence; mov