On Wed, 26 Jul 2017, Alexander Monakov wrote: > On Wed, 26 Jul 2017, Jeff Law wrote: > > I'm not sure what you mean by extraneous compiler barriers -- isn't the > > worst case scenario here that the target emits them as well? So there > > would be an extraneous one in that case, but that ought to be a "don't > > care". > > Yes, exactly this.
I've just realized that we can detect if the backend produced empty RTL sequence by looking at get_last_insn () before/after gen_mem_thread_fence. This way we can emit a compiler barrier iff the backend didn't emit a machine barrier. Alexander