[PATCH] D66794: [WebAssembly] Add atomic.fence instruction

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 07:03:39 PDT 2019


aheejin added inline comments.


================
Comment at: llvm/test/CodeGen/WebAssembly/atomic-fence.ll:34
 ; CHECK-LABEL: singlethread_fence:
 ; CHECK-NOT:  compiler_fence
 define void @singlethread_fence() {
----------------
dschuff wrote:
> how about `CHECK-NOT: fence` to catch any kind of fence output?
> Even better, could we also come up with some sequence of instructions that would otherwise be reordered (e.g. by register stackification) that the fence would prevent?
> how about CHECK-NOT: fence to catch any kind of fence output?
`CHECK-NOT: fence` doesn't work because it accidentally matches with `.functype singlethread_fence () -> ()` in the output. Added `CHECK-NOT: atomic-fence` additionally.

> Even better, could we also come up with some sequence of instructions that would otherwise be reordered (e.g. by register stackification) that the fence would prevent?
I think it is not easy to show exactly that in this ll test... Added a mir test for that. (The reason I used `atomic.notify` is, that's one of the rare, maybe the only, instructions that returns a value and has a side effect that's not a trap, which is the condition that satisfies [[ https://github.com/llvm/llvm-project/blob/cff90f07cb5cc3c3bc58277926103af31caef308/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp#L218-L246 | this line. ]])


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66794/new/

https://reviews.llvm.org/D66794





More information about the llvm-commits mailing list