Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/SPIRV/LLVMToSPIRVDbgTran.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1605,10 +1605,13 @@ LLVMToSPIRVDbgTran::transDbgLocalVariable(const DILocalVariable *Var) {
Ops[ColumnIdx] = 0; // This version of DILocalVariable has no column number
Ops[ParentIdx] = getScope(Var->getScope())->getId();
Ops[FlagsIdx] = transDebugFlags(Var);
if (SPIRVWord ArgNumber = Var->getArg())
std::vector<SPIRVWord> ConstantArgs = {LineIdx, ColumnIdx, FlagsIdx};
if (SPIRVWord ArgNumber = Var->getArg()) {
Ops.push_back(ArgNumber);
ConstantArgs.push_back(ArgNumberIdx);
}
if (isNonSemanticDebugInfo())
transformToConstant(Ops, {LineIdx, ColumnIdx, FlagsIdx});
transformToConstant(Ops, ConstantArgs);
return BM->addDebugInfo(SPIRVDebug::LocalVariable, getVoidTy(), Ops);
}

Expand Down
10 changes: 6 additions & 4 deletions lib/SPIRV/SPIRVToLLVMDbgTran.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,9 +1203,12 @@ DINode *SPIRVToLLVMDbgTran::transLocalVariable(const SPIRVExtInst *DebugInst) {
if (SPIRVFlags & SPIRVDebug::FlagIsObjectPointer)
Flags |= DINode::FlagObjectPointer;

if (Ops.size() > ArgNumberIdx)
if (Ops.size() > ArgNumberIdx) {
SPIRVWord ArgNo = getConstantValueOrLiteral(Ops, ArgNumberIdx,
DebugInst->getExtSetKind());
return getDIBuilder(DebugInst).createParameterVariable(
Scope, Name, Ops[ArgNumberIdx], File, LineNo, Ty, true, Flags);
Scope, Name, ArgNo, File, LineNo, Ty, true, Flags);
}
return getDIBuilder(DebugInst).createAutoVariable(Scope, Name, File, LineNo,
Ty, true, Flags);
}
Expand Down Expand Up @@ -1682,8 +1685,7 @@ SPIRVToLLVMDbgTran::transDebugIntrinsic(const SPIRVExtInst *DebugInst,
return DbgDeclare;
}
return DIB.insertDeclare(GetValue(Ops[VariableIdx]), LocalVar.first,
GetExpression(Ops[ExpressionIdx]), Loc,
BB);
GetExpression(Ops[ExpressionIdx]), Loc, BB);
}
case SPIRVDebug::Value: {
using namespace SPIRVDebug::Operand::DebugValue;
Expand Down
Loading