[llvm] LLVMContext: add getSyncScopeName() to lookup individual scope name (PR #109484)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 04:56:49 PDT 2024


================
@@ -4190,13 +4190,11 @@ NVPTX::Scope NVPTXScopes::operator[](SyncScope::ID ID) const {
                      "NVPTXScopes::operator[]");
 
   auto S = Scopes.find(ID);
-  if (S == Scopes.end()) {
-    // TODO:
-    // - Add API to LLVMContext to get the name of a single scope.
-    // - Use that API here to print an error containing the name
-    //   of this Unknown ID.
-    report_fatal_error(formatv("Could not find scope ID={}.", int(ID)));
-  }
+  if (S == Scopes.end())
+    report_fatal_error(formatv("Could not find scope ID={} with name \"{}\".",
----------------
arsenm wrote:

If you really want this to be an error, I think this would be better to use C.emitError instead of a hard exit immediately 

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


More information about the llvm-commits mailing list