[PATCH] D36580: [OpenCL] Support variable memory scope in atomic builtins

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 11 10:54:24 PDT 2017


rjmccall added inline comments.


================
Comment at: include/clang/Basic/SyncScope.h:47
+  return Scopes;
+}
+
----------------
You could just return an ArrayRef to a static const array.


================
Comment at: lib/CodeGen/CGAtomic.cpp:687
+
+  auto *SC = Builder.CreateIntCast(Scope, Builder.getInt32Ty(), false);
+  // If unsupported sync scope is encountered at run time, assume default sync
----------------
Does Sema not coerce the argument to int?  It really should, and then you can just rely on that here.  (You should use CGF.IntTy if you do this, though, in case you're on a target with a non-32-bit int.)


https://reviews.llvm.org/D36580





More information about the cfe-commits mailing list