spirv-fuzz: Pass OpUndef in function call if needed (#3978)

Fixes #3977.
This commit is contained in:
Alastair Donaldson 2020-10-22 12:06:54 +01:00 committed by GitHub
parent de2c0ba202
commit 53f2a69c19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -141,9 +141,13 @@ std::vector<uint32_t> FuzzerPassAddFunctionCalls::ChooseFunctionCallArguments(
assert(param_type && "Parameter has invalid type");
if (!param_type->AsPointer()) {
// We mark the constant as irrelevant so that we can replace it with a
// more interesting value later.
result.push_back(FindOrCreateZeroConstant(param->type_id(), true));
if (fuzzerutil::CanCreateConstant(GetIRContext(), param->type_id())) {
// We mark the constant as irrelevant so that we can replace it with a
// more interesting value later.
result.push_back(FindOrCreateZeroConstant(param->type_id(), true));
} else {
result.push_back(FindOrCreateGlobalUndef(param->type_id()));
}
continue;
}