mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2025-01-11 09:00:06 +00:00
parent
4a92579a45
commit
2c1ff230c2
@ -105,6 +105,13 @@ void TransformationAddParameter::Apply(
|
||||
if (ir_context->get_def_use_mgr()->NumUsers(old_function_type) == 1) {
|
||||
// Adjust existing function type if it is used only by this function.
|
||||
old_function_type->AddOperand({SPV_OPERAND_TYPE_ID, {parameter_type_id}});
|
||||
|
||||
// We must make sure that all dependencies of |old_function_type| are
|
||||
// evaluated before |old_function_type| (i.e. the domination rules are not
|
||||
// broken). Thus, we move |old_function_type| to the end of the list of all
|
||||
// types in the module.
|
||||
old_function_type->RemoveFromList();
|
||||
ir_context->AddType(std::unique_ptr<opt::Instruction>(old_function_type));
|
||||
} else {
|
||||
// Otherwise, either create a new type or use an existing one.
|
||||
std::vector<uint32_t> type_ids;
|
||||
|
@ -102,9 +102,9 @@ TEST(TransformationAddParameterTest, BasicTest) {
|
||||
%7 = OpTypeBool
|
||||
%11 = OpTypeInt 32 1
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFunction %7 %7 %11
|
||||
%8 = OpConstant %11 23
|
||||
%12 = OpConstantTrue %7
|
||||
%6 = OpTypeFunction %7 %7 %11
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%13 = OpFunctionCall %7 %9 %12 %8
|
||||
|
Loading…
Reference in New Issue
Block a user