[PATCH] D57874: [WebAssembly] Set '-matomics' when '-pthread' is set

Derek Schuff via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 7 10:44:47 PST 2019

dschuff added a comment.

So this CL has the effect that setting `-pthreads` will also set `-matomics`.
Currently as you mentioned we have the problem that we can't make our current logic of "do we lower away the atomics" be controlled by the target features because it's done at pass config time and not codegen time (where there's no access to the per-function subtarget). 
Also IIUC on ARM, it's `-mthread-model` that controls generation of atomic instructions, so it makes sense that `-mthread-model` does the same thing for Wasm. But it's also true that for wasm we use `-m<feature>` to enable codegen for a particular wasm feature, so it would be good to make `-matomics` do the same for consistency.
So, can we just pin those 2 flags together here? i.e. setting one will just cause the other to be set?
(I guess we'd also need consistency check so that if someone does something like `-mthread-model=posix -mno-atomics` we either throw an error or make it so that one of those always overrides the other).

  rC Clang



More information about the cfe-commits mailing list