[LLVMdev] Question on Fence Instruction

陳韋任 (Wei-Ren Chen) chenwj at iis.sinica.edu.tw
Wed Oct 17 08:08:34 PDT 2012

On Wed, Oct 17, 2012 at 02:21:40PM +0000, Duan, Yue Lu wrote:
> Thank you very much for the quick reply. I was trying to confirm what I did was correct. I did a test that could enable a simple way of sc-preserving compilation by inserting fences for every load/store instruction before any opts, applying standard opts and then removing them after assembly code generation. It turned out that such sc-preserving compilation only caused ~4% slowdown for 18 benchmarks on average on a Intel Xeon machine. The result surprised me a lot because it was reported that such naive way of compilation can cause 20% slowdown in a recent PLDI paper (they also use LLVM), so I posted this question. I will try to examine if the generated binary code really respects sc fences.

  My 2 cents is that maybe x86 already has a pretty strong memory model that
it doesn't cause much performance loss if you remove those SC fence.


Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj

More information about the llvm-dev mailing list