[llvm] [NVPTX] Print SyncScope::ID if out of bounds (PR #109871)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 10:37:48 PDT 2024


================
@@ -244,6 +244,16 @@ void LLVMContextImpl::getSyncScopeNames(
     SSNs[SSE.second] = SSE.first();
 }
 
+std::optional<StringRef>
+LLVMContextImpl::getSyncScopeName(SyncScope::ID Id) const {
+  for (const auto &SSE : SSC) {
+    if (SSE.second != Id)
+      continue;
+    return SSE.first();
+  }
----------------
Artem-B wrote:

No need for explicit `continue` here:
```
for (const auto &SSE : SSC)
    if (SSE.second == Id)
      return SSE.first();
```

https://github.com/llvm/llvm-project/pull/109871


More information about the llvm-commits mailing list