[llvm] [NVPTX] Add more clear error message for using invalid syncscope (PR #165737)

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 31 16:10:33 PDT 2025


================
@@ -1851,11 +1851,22 @@ NVPTX::Scope NVPTXScopes::operator[](SyncScope::ID ID) const {
 
   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)));
+    // Get the actual scope name from LLVMContext for a better error message
+    std::string scopeName = "<unknown>";
----------------
AlexMaclean wrote:

Is this expected to ever happen? If so, please add a test, if not perhaps change to an assert?

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


More information about the llvm-commits mailing list