[llvm-branch-commits] [llvm] [NFC][SPIRV] Converge different `resolveDebugParentScope` versions into a single one (PR #219925)

Diego Novillo via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Aug 31 07:22:22 PDT 2026


Juan Manuel Martinez =?utf-8?q?CaamaƱo?Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/219925 at github.com>


================
@@ -878,7 +818,12 @@ std::optional<MCRegister> SPIRVNonSemanticDebugHandler::emitDebugGlobalVariable(
     SPIRV::ModuleAnalysisInfo &MAI) {
   assert(GV && "GV must not be null in emitDebugGlobalVariable");
 
-  MCRegister ParentReg = resolveGlobalVariableParent(GV);
+  assert(!CompileUnits.empty() &&
+         "emitDebugGlobalVariable requires non-empty CompileUnits");
+  auto ParentRegOpt = resolveScope(GV->getScope());
+  assert(ParentRegOpt && "DebugCompilationUnit must be emitted before "
----------------
dnovillo wrote:

I think you mean to do something along the lines of `if (!ParentRegOpt) return nullopt;`? Definitely don't want to crash if this happens :)

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


More information about the llvm-branch-commits mailing list