Skip to content

Commit 4d6f76e

Browse files
committed
[SYCL] Cherry-pick 295b14eaea8ea4cd37a09dd5dc50eb6ac3d8a4d9
This is to fix the build after llvm/llvm-project@ecd2aae "[DebugInfo] Merge DebugInfoFinder::{processDeclare,processValue} into processVariable" Signed-off-by: Alexey Sotkin <[email protected]> Signed-off-by: Vladimir Lazarev <[email protected]>
1 parent 30f770b commit 4d6f76e

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

llvm-spirv/lib/SPIRV/LLVMToSPIRVDbgTran.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,28 +70,28 @@ void LLVMToSPIRVDbgTran::transDebugMetadata() {
7070
for (const DISubprogram *F : DIF.subprograms())
7171
transDbgEntry(F);
7272

73-
for (const DbgDeclareInst *DDI : DbgDeclareIntrinsics)
73+
for (const DbgVariableIntrinsic *DDI : DbgDeclareIntrinsics)
7474
finalizeDebugDeclare(DDI);
7575

76-
for (const DbgValueInst *DVI : DbgValueIntrinsics)
76+
for (const DbgVariableIntrinsic *DVI : DbgValueIntrinsics)
7777
finalizeDebugValue(DVI);
7878

7979
transLocationInfo();
8080
}
8181

8282
// llvm.dbg.declare intrinsic.
8383

84-
SPIRVValue *
85-
LLVMToSPIRVDbgTran::createDebugDeclarePlaceholder(const DbgDeclareInst *DbgDecl,
86-
SPIRVBasicBlock *BB) {
84+
SPIRVValue *LLVMToSPIRVDbgTran::createDebugDeclarePlaceholder(
85+
const DbgVariableIntrinsic *DbgDecl, SPIRVBasicBlock *BB) {
8786
DbgDeclareIntrinsics.push_back(DbgDecl);
8887
using namespace SPIRVDebug::Operand::DebugDeclare;
8988
SPIRVWordVec Ops(OperandCount, getDebugInfoNoneId());
9089
SPIRVId ExtSetId = BM->getExtInstSetId(SPIRVEIS_Debug);
9190
return BM->addExtInst(getVoidTy(), ExtSetId, SPIRVDebug::Declare, Ops, BB);
9291
}
9392

94-
void LLVMToSPIRVDbgTran::finalizeDebugDeclare(const DbgDeclareInst *DbgDecl) {
93+
void LLVMToSPIRVDbgTran::finalizeDebugDeclare(
94+
const DbgVariableIntrinsic *DbgDecl) {
9595
SPIRVValue *V = SPIRVWriter->getTranslatedValue(DbgDecl);
9696
assert(V && "llvm.dbg.declare intrinsic isn't mapped to a SPIRV instruction");
9797
assert(V->isExtInst(SPIRV::SPIRVEIS_Debug, SPIRVDebug::Declare) &&
@@ -100,7 +100,7 @@ void LLVMToSPIRVDbgTran::finalizeDebugDeclare(const DbgDeclareInst *DbgDecl) {
100100
return;
101101
SPIRVExtInst *DD = static_cast<SPIRVExtInst *>(V);
102102
SPIRVBasicBlock *BB = DD->getBasicBlock();
103-
llvm::Value *Alloca = DbgDecl->getAddress();
103+
llvm::Value *Alloca = DbgDecl->getVariableLocation();
104104

105105
using namespace SPIRVDebug::Operand::DebugDeclare;
106106
SPIRVWordVec Ops(OperandCount);
@@ -113,10 +113,9 @@ void LLVMToSPIRVDbgTran::finalizeDebugDeclare(const DbgDeclareInst *DbgDecl) {
113113

114114
// llvm.dbg.value intrinsic.
115115

116-
SPIRVValue *
117-
LLVMToSPIRVDbgTran::createDebugValuePlaceholder(const DbgValueInst *DbgValue,
118-
SPIRVBasicBlock *BB) {
119-
if (!DbgValue->getValue())
116+
SPIRVValue *LLVMToSPIRVDbgTran::createDebugValuePlaceholder(
117+
const DbgVariableIntrinsic *DbgValue, SPIRVBasicBlock *BB) {
118+
if (!DbgValue->getVariableLocation(/* AllowNullOp = */ false))
120119
return nullptr; // It is pointless without new value
121120

122121
DbgValueIntrinsics.push_back(DbgValue);
@@ -126,7 +125,8 @@ LLVMToSPIRVDbgTran::createDebugValuePlaceholder(const DbgValueInst *DbgValue,
126125
return BM->addExtInst(getVoidTy(), ExtSetId, SPIRVDebug::Value, Ops, BB);
127126
}
128127

129-
void LLVMToSPIRVDbgTran::finalizeDebugValue(const DbgValueInst *DbgValue) {
128+
void LLVMToSPIRVDbgTran::finalizeDebugValue(
129+
const DbgVariableIntrinsic *DbgValue) {
130130
SPIRVValue *V = SPIRVWriter->getTranslatedValue(DbgValue);
131131
assert(V && "llvm.dbg.value intrinsic isn't mapped to a SPIRV instruction");
132132
assert(V->isExtInst(SPIRV::SPIRVEIS_Debug, SPIRVDebug::Value) &&
@@ -135,7 +135,7 @@ void LLVMToSPIRVDbgTran::finalizeDebugValue(const DbgValueInst *DbgValue) {
135135
return;
136136
SPIRVExtInst *DV = static_cast<SPIRVExtInst *>(V);
137137
SPIRVBasicBlock *BB = DV->getBasicBlock();
138-
Value *Val = DbgValue->getValue();
138+
Value *Val = DbgValue->getVariableLocation(/* AllowNullOp = */ false);
139139

140140
using namespace SPIRVDebug::Operand::DebugValue;
141141
SPIRVWordVec Ops(MinOperandCount);

llvm-spirv/lib/SPIRV/LLVMToSPIRVDbgTran.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@ class LLVMToSPIRVDbgTran {
6868
// but with dummy operands. Doing so we a) map llvm value to spirv value,
6969
// b) get a place for SPIRV debug info intrinsic in SPIRV basic block.
7070
// We also remember all debug intrinsics.
71-
SPIRVValue *createDebugDeclarePlaceholder(const DbgDeclareInst *DbgDecl,
71+
SPIRVValue *createDebugDeclarePlaceholder(const DbgVariableIntrinsic *DbgDecl,
7272
SPIRVBasicBlock *BB);
73-
SPIRVValue *createDebugValuePlaceholder(const DbgValueInst *DbgValue,
73+
SPIRVValue *createDebugValuePlaceholder(const DbgVariableIntrinsic *DbgValue,
7474
SPIRVBasicBlock *BB);
7575

7676
private:
7777
// 2. After translation of all regular instructions we deal with debug info.
7878
// We iterate over debug intrinsics stored on the first step, get its mapped
7979
// SPIRV instruction and tweak the operands.
80-
void finalizeDebugDeclare(const DbgDeclareInst *DbgDecl);
81-
void finalizeDebugValue(const DbgValueInst *DbgValue);
80+
void finalizeDebugDeclare(const DbgVariableIntrinsic *DbgDecl);
81+
void finalizeDebugValue(const DbgVariableIntrinsic *DbgValue);
8282

8383
// Emit DebugScope and OpLine instructions
8484
void transLocationInfo();
@@ -154,8 +154,8 @@ class LLVMToSPIRVDbgTran {
154154
SPIRVType *VoidT;
155155
SPIRVEntry *DebugInfoNone;
156156
SPIRVExtInst *SPIRVCU;
157-
std::vector<const DbgDeclareInst *> DbgDeclareIntrinsics;
158-
std::vector<const DbgValueInst *> DbgValueIntrinsics;
157+
std::vector<const DbgVariableIntrinsic *> DbgDeclareIntrinsics;
158+
std::vector<const DbgVariableIntrinsic *> DbgValueIntrinsics;
159159
}; // class LLVMToSPIRVDbgTran
160160

161161
} // namespace SPIRV

0 commit comments

Comments
 (0)