[PATCH] D132352: Introduce noread_thread_id to address the thread identification problem in coroutines

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 22 20:57:04 PDT 2022


rjmccall added a comment.

Okay.  Doc parts LGTM, but I don't



================
Comment at: llvm/include/llvm/IR/InstrTypes.h:1855
+  }
+  void setNoReadThreadID() { addFnAttr(Attribute::NoReadThreadID); }
+
----------------
The closest existing precedent would suggest `doesNotReadThreadID` and `setDoesNotReadThreadID`.


================
Comment at: llvm/include/llvm/IR/InstrTypes.h:1857
+
+  /// Return true if the call does not read thread ID or the call doesn't lives
+  /// in a presplit coroutine function.
----------------



================
Comment at: llvm/include/llvm/IR/InstrTypes.h:1863
+  /// not access or only reads memory.
+  bool doesNotReadThreadIDNorLivesInPresplitCoroutine() const {
+    return doesNoReadThreadID() || !getFunction() ||
----------------
This is an odd use of "nor".  Maybe take a different approach — `canReadDifferentThreadIDIfMoved()`?


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

https://reviews.llvm.org/D132352



More information about the cfe-commits mailing list