Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .references/spirv-tools
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dfc5ab8
fbe4f3a
43 changes: 6 additions & 37 deletions spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ constexpr uint32_t kExtInstOpInIdx = 1;
constexpr uint32_t kInterpolantInIdx = 2;
constexpr uint32_t kCooperativeMatrixLoadSourceAddrInIdx = 0;
constexpr uint32_t kDebugDeclareVariableInIdx = 3;
constexpr uint32_t kDebugValueLocalVariableInIdx = 2;
constexpr uint32_t kDebugValueValueInIdx = 3;
constexpr uint32_t kDebugValueExpressionInIdx = 4;

// Sorting functor to present annotation instructions in an easy-to-process
// order. The functor orders by opcode first and falls back on unique id
Expand Down Expand Up @@ -309,8 +307,8 @@ Pass::Status AggressiveDCEPass::ProcessDebugInformation(
// DebugDeclare Variable is not live. Find the value that was being
// stored to this variable. If it's live then create a new DebugValue
// with this value. Otherwise let it die in peace.
get_def_use_mgr()->ForEachUser(var_id, [this, var_id,
inst](Instruction* user) {
get_def_use_mgr()->ForEachUser(var_id, [this,
var_id](Instruction* user) {
if (user->opcode() == spv::Op::OpStore) {
uint32_t stored_value_id = 0;
const uint32_t kStoreValueInIdx = 1;
Expand All @@ -320,13 +318,13 @@ Pass::Status AggressiveDCEPass::ProcessDebugInformation(
}

// value being stored is still live
Instruction* next_inst = inst->NextNode();
Instruction* next_inst = user->NextNode();
bool added =
context()->get_debug_info_mgr()->AddDebugValueForVariable(
user, var_id, stored_value_id, inst);
user, var_id, stored_value_id, user);
if (added && next_inst) {
auto new_debug_value = next_inst->PreviousNode();
live_insts_.Set(new_debug_value->unique_id());
AddToWorklist(new_debug_value);
}
}
return true;
Expand All @@ -344,42 +342,13 @@ Pass::Status AggressiveDCEPass::ProcessDebugInformation(

// Value operand of DebugValue is not live
// Set Value to Undef of appropriate type
live_insts_.Set(inst->unique_id());

uint32_t type_id = def->type_id();
auto type_def = get_def_use_mgr()->GetDef(type_id);
AddToWorklist(type_def);

uint32_t undef_id = Type2Undef(type_id);
if (undef_id == 0) return false;

auto undef_inst = get_def_use_mgr()->GetDef(undef_id);
live_insts_.Set(undef_inst->unique_id());
inst->SetInOperand(var_operand_idx, {undef_id});
context()->get_def_use_mgr()->AnalyzeInstUse(inst);

id = inst->GetSingleWordInOperand(kDebugValueLocalVariableInIdx);
auto localVar = get_def_use_mgr()->GetDef(id);
AddToWorklist(localVar);

uint32_t expr_idx = kDebugValueExpressionInIdx;
id = inst->GetSingleWordInOperand(expr_idx);
auto expression = get_def_use_mgr()->GetDef(id);
AddToWorklist(expression);

for (uint32_t i = expr_idx + 1; i < inst->NumInOperands(); ++i) {
id = inst->GetSingleWordInOperand(i);
auto index_def = get_def_use_mgr()->GetDef(id);
if (index_def) {
AddToWorklist(index_def);
}
}

for (auto& line_inst : inst->dbg_line_insts()) {
if (line_inst.IsDebugLineInst()) {
AddToWorklist(&line_inst);
}
}
AddToWorklist(inst);
}
return true;
});
Expand Down
2 changes: 1 addition & 1 deletion spirv-tools/spirv-tools/build-version.inc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"v2026.1-dev", "SPIRV-Tools v2026.1-dev v2025.5-58-gdfc5ab82"
"v2026.1", "SPIRV-Tools v2026.1 v2026.1.rc1-0-gfbe4f3ad"