<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"># This patch is needed for ISPC for Xe only
# It disables using of DIArgList for dbg.val if SPIR-V target is used.
# It is needed till DIArgList is supported in SPIR-V Translator.
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 1c350a258..55f783643 100644
--- llvm/lib/Transforms/Utils/Local.cpp.orig
+++ llvm/lib/Transforms/Utils/Local.cpp
@@ -1798,7 +1798,16 @@ void llvm::salvageDebugInfoForDbgValues(
     } else if (isa&lt;DbgValueInst&gt;(DII) &amp;&amp; IsValidSalvageExpr &amp;&amp;
                DII-&gt;getNumVariableLocationOps() + AdditionalValues.size() &lt;=
                    MaxDebugArgs) {
-      DII-&gt;addVariableLocationOps(AdditionalValues, SalvagedExpr);
+      if (!Triple(I.getModule()-&gt;getTargetTriple()).isSPIR()) {
+        DII-&gt;addVariableLocationOps(AdditionalValues, SalvagedExpr);
+      } else {
+        // Do not salvage using DIArgList for dbg.addr/dbg.declare, as it is
+        // currently only valid for stack value expressions.
+        // Also do not salvage if the resulting DIArgList would contain an
+        // unreasonably large number of values.
+        Value *Undef = UndefValue::get(I.getOperand(0)-&gt;getType());
+        DII-&gt;replaceVariableLocationOp(I.getOperand(0), Undef);
+      }
     } else {
       // Do not salvage using DIArgList for dbg.addr/dbg.declare, as it is
       // currently only valid for stack value expressions.
</pre></body></html>