jobextra/llvm14/disable-DIArgList-in-SPIR-V...

24 lines
1.2 KiB
Diff

# 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 d03d76f57ca1..0b86e454df57 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -1771,7 +1771,14 @@ void llvm::salvageDebugInfoForDbgValues(
} else if (isa<DbgValueInst>(DII) &&
DII->getNumVariableLocationOps() + AdditionalValues.size() <=
MaxDebugArgs) {
- DII->addVariableLocationOps(AdditionalValues, SalvagedExpr);
+ if (!Triple(I.getModule()->getTargetTriple()).isSPIR()) {
+ DII->addVariableLocationOps(AdditionalValues, SalvagedExpr);
+ } else {
+ // Do not salvage using DIArgList for dbg.val fpr SPIR-V target, as it is
+ // not currently supported by SPIR-V Translator.
+ Value *Undef = UndefValue::get(I.getOperand(0)->getType());
+ DII->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.