[PATCH] D18156: AMDGPU: mark atomic instructions as sources of divergence

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 16 06:46:19 PDT 2016


tstellarAMD added inline comments.

================
Comment at: lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp:189-195
@@ -188,2 +188,9 @@
 
+  // Atomics are divergent because they are executed sequentially: when an
+  // atomic operation refers to the same address in each thread, then each
+  // thread after the first sees the value written by the previous thread as
+  // original value.
+  if (isa<AtomicRMWInst>(V) || isa<AtomicCmpXchgInst>(V))
+    return true;
+
   if (const IntrinsicInst *Intrinsic = dyn_cast<IntrinsicInst>(V)) {
----------------
Are these still divergent if the return value isn't used?


http://reviews.llvm.org/D18156





More information about the llvm-commits mailing list