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 @@
77a096c
d3f9ef1
32 changes: 32 additions & 0 deletions spirv-tools/source/val/validate_cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,34 @@ spv_result_t ValidateLoopMerge(ValidationState_t& _, const Instruction* inst) {
return SPV_SUCCESS;
}

spv_result_t ValidateLifetime(ValidationState_t& _, const Instruction* inst) {
const uint32_t pointer_id = _.GetOperandTypeId(inst, 0);
const Instruction* pointer_inst = _.FindDef(pointer_id);
if (pointer_inst->opcode() != spv::Op::OpTypePointer) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "Op" << spvOpcodeString(inst->opcode())
<< " pointer operand type must be a OpTypePointer.";
} else if (pointer_inst->GetOperandAs<spv::StorageClass>(1) !=
spv::StorageClass::Function) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "Op" << spvOpcodeString(inst->opcode())
<< " pointer operand must be in the Function storage class.";
}

const uint32_t size = inst->GetOperandAs<uint32_t>(1);
if (size != 0) {
if (!_.HasCapability(spv::Capability::Addresses)) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< "Op" << spvOpcodeString(inst->opcode())
<< " size is non-zero, but the Addresses Capability is not "
"declared.";
}
// TODO - "Size must be 0 if Pointer is a pointer to a non-void type"
}

return SPV_SUCCESS;
}

} // namespace

void printDominatorList(const BasicBlock& b) {
Expand Down Expand Up @@ -1268,6 +1296,10 @@ spv_result_t ControlFlowPass(ValidationState_t& _, const Instruction* inst) {
case spv::Op::OpLoopMerge:
if (auto error = ValidateLoopMerge(_, inst)) return error;
break;
case spv::Op::OpLifetimeStart:
case spv::Op::OpLifetimeStop:
if (auto error = ValidateLifetime(_, inst)) return error;
break;
default:
break;
}
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", "SPIRV-Tools v2026.1 v2026.1.rc1-2-g77a096c9"
"v2026.1", "SPIRV-Tools v2026.1 v2026.1-4-gd3f9ef11"