aboutsummaryrefslogtreecommitdiff
path: root/source/fuzz/transformation_replace_parameter_with_global.cpp
diff options
context:
space:
mode:
authorDavid Neto <dneto@google.com>2023-01-16 16:49:38 -0500
committerDavid Neto <dneto@google.com>2023-01-16 16:49:38 -0500
commitd75f78543eeb24bd8441f2f07f34d273613c64fa (patch)
tree79f44f1cf0117c5992d776fcc12e772ad149cc00 /source/fuzz/transformation_replace_parameter_with_global.cpp
parent397165890b264486d2f4826bde034e9ee8a31a84 (diff)
parent0e6fbba7762c071118b3e84258a358ede31fb609 (diff)
downloadspirv-tools-d75f78543eeb24bd8441f2f07f34d273613c64fa.tar.gz
Merge commit '0e6fbba7762c0' into update-shaderc
Includes: 0e6fbba7 Prepare for v2023.1 release (#5057) 1dad9914 cmake: Modernize install(TARGET) usage (#5056) ae893db2 cmake: Remove old policy code (#5055) ae8d5070 Add Github Actions to test Bazel builds. (#5043) 7e8813bb Validate version 5 of clspv reflection (#5050) bfd27861 utils: repos use 'main' as main devlopment branch (#5054) 631f9bcb Update README.md: Development occurs on the "main" branch (#5053) f62e121b spirv-val: Use more specific term 'switch header' in error message (#5048) d87f6160 DEPS: update to last googletest release supporting C++11 (#5045) f416d39b Bazel: Use @platforms//os:windows instead of @build_tools//src/conditions:windows (#5042) 077b09c3 Add exported CMake config file for binaries in ./tools/ (#5034) bbdd0fef Update minimum required CMake to 3.17.2 (#5041) 01a3b9be git-sync-deps: Use argparse, and print better help (#5038) 6b5a00eb Kokoro CI bots use git-sync-deps to get sources (#5031) c5d23164 Enforce layering_check in Bazel build rules. (#5032) 5bec0884 Remove testing support for VS2015 (#5027) 29375382 Fix undef behaviour in hex float parsing (#5025) 025ea891 Optimize allocation of spvtools::opt::Instruction::operands_ (#5024) 1c287b03 First attempt to set up CI-windows-msvc-2017-release-bazel build (#5023) f64a4b64 [spirv-opt] Clone names for new struct in EliminateIODeadComponents (#5016) cc81529f Test operator overloads for SPIR-V C++ mask enums (#5021) 5a78d798 Fix layout validation (#5015) 451ba8ec README.md: The validator now handles larger limits (#5003) 6b2318ae Fix for bug https://github.com/KhronosGroup/SPIRV-Tools/issues/5017 (#5019) 5d6adbde Require C++11 *or later* (#5020) 43c99b5e Roll external/spirv-headers/ 47f2465ee..1d31a1004 (13 commits) (#5012) 235182cf Fix use of invalid analysis (#5013) 9c6a925c Fix infinite loop in validator (#5006) 7b8f00f0 spirv-opt: Fix OpCompositeInsert with Null Constant (#5008) 40f5bf59 Revert "spirv-val: Multiple interface var with same SC (#4969)" (#5009) d9446130 Update BUILD.gn with recently added file (#5004) 00018e58 Change EliminateDeadInputComponentsPass to EliminateDeadIOComponentsPass (#4997) 9a6f4121 Fix missing declaration of std::numeric_limits (#5002) f33d1524 Add validation support for SPV_NV_shader_invocation_reorder. (#4979) 597631b6 spirv-opt: Handle null CompositeInsert (#4998) 81ec2aaa Add option to ADCE to remove output variables from interface. (#4994) 46ca66e6 Add support for tesc, tese and geom to EliminateDead*Components (#4990) 1a7f71af clean: constexpr-ify and unify anon namespace use (#4991) 8ea3ae6b Split EliminateDeadInputComponents into safe and unsafe versions. (#4984) a8647f59 Use Python3 for presubmit (#4986) 68e8327f Instrument: Change output buffer offset definitions (#4961) 996d4c02 spirv-val: Multiple interface var with same SC (#4969) aae7d413 Fix macos kokoro builds (#4985) 525bc380 Add pass to eliminate dead output components (#4982) 54d4e77f spirv-opt: Add const folding for CompositeInsert (#4943) a5e766b2 spirv-val: Add VUID label for 07703 (#4980) d35a78db Switch SPIRV-Tools to use spirv.hpp11 internally (#4981) c8e1588c Add passes to eliminate dead output stores (#4970) a52de681 Prevent eliminating case constructs in block merging (#4976) 4563d909 Only validate full layout in Vulkan environments (#4972) 9f3a4afa spirv-val: Label new Vulkan OpPtrAccessChain VUs (#4975) b49a2caa Revert "test" (#4974) da215f10 test 7326b967 Prevent null pointer from being dereferenced (#4971) 0ebf8305 spirv-val: Add OpPtrAccessChain Base checks (#4965) eb113f0f spirv-val: Improve PR 4831 error message (#4968) ecd5b9c1 spirv-val: Add remaining Component decoration validation (#4966) b53d3a6b Start SPIRV-Tools v2022.5 Testing: checkbuild.py on Linux Change-Id: I741e8c105647c8e11d5190af9f9102421f7533d6
Diffstat (limited to 'source/fuzz/transformation_replace_parameter_with_global.cpp')
-rw-r--r--source/fuzz/transformation_replace_parameter_with_global.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/source/fuzz/transformation_replace_parameter_with_global.cpp b/source/fuzz/transformation_replace_parameter_with_global.cpp
index caf67168..e80dfe90 100644
--- a/source/fuzz/transformation_replace_parameter_with_global.cpp
+++ b/source/fuzz/transformation_replace_parameter_with_global.cpp
@@ -41,7 +41,7 @@ bool TransformationReplaceParameterWithGlobal::IsApplicable(
// Check that |parameter_id| is valid.
const auto* param_inst =
ir_context->get_def_use_mgr()->GetDef(message_.parameter_id());
- if (!param_inst || param_inst->opcode() != SpvOpFunctionParameter) {
+ if (!param_inst || param_inst->opcode() != spv::Op::OpFunctionParameter) {
return false;
}
@@ -69,7 +69,7 @@ bool TransformationReplaceParameterWithGlobal::IsApplicable(
// Check that pointer type for the global variable exists in the module.
if (!fuzzerutil::MaybeGetPointerType(ir_context, param_inst->type_id(),
- SpvStorageClassPrivate)) {
+ spv::StorageClass::Private)) {
return false;
}
@@ -91,8 +91,8 @@ void TransformationReplaceParameterWithGlobal::Apply(
fuzzerutil::AddGlobalVariable(
ir_context, message_.global_variable_fresh_id(),
fuzzerutil::MaybeGetPointerType(ir_context, param_inst->type_id(),
- SpvStorageClassPrivate),
- SpvStorageClassPrivate,
+ spv::StorageClass::Private),
+ spv::StorageClass::Private,
fuzzerutil::MaybeGetZeroConstant(ir_context, *transformation_context,
param_inst->type_id(), false));
@@ -103,16 +103,17 @@ void TransformationReplaceParameterWithGlobal::Apply(
// Insert an OpLoad instruction right after OpVariable instructions.
auto it = function->begin()->begin();
while (it != function->begin()->end() &&
- !fuzzerutil::CanInsertOpcodeBeforeInstruction(SpvOpLoad, it)) {
+ !fuzzerutil::CanInsertOpcodeBeforeInstruction(spv::Op::OpLoad, it)) {
++it;
}
- assert(fuzzerutil::CanInsertOpcodeBeforeInstruction(SpvOpLoad, it) &&
+ assert(fuzzerutil::CanInsertOpcodeBeforeInstruction(spv::Op::OpLoad, it) &&
"Can't insert OpLoad or OpCopyMemory into the first basic block of "
"the function");
it.InsertBefore(MakeUnique<opt::Instruction>(
- ir_context, SpvOpLoad, param_inst->type_id(), param_inst->result_id(),
+ ir_context, spv::Op::OpLoad, param_inst->type_id(),
+ param_inst->result_id(),
opt::Instruction::OperandList{
{SPV_OPERAND_TYPE_ID, {message_.global_variable_fresh_id()}}}));
@@ -132,13 +133,14 @@ void TransformationReplaceParameterWithGlobal::Apply(
// Update all relevant OpFunctionCall instructions.
for (auto* inst : fuzzerutil::GetCallers(ir_context, function->result_id())) {
- assert(fuzzerutil::CanInsertOpcodeBeforeInstruction(SpvOpStore, inst) &&
- "Can't insert OpStore right before the function call");
+ assert(
+ fuzzerutil::CanInsertOpcodeBeforeInstruction(spv::Op::OpStore, inst) &&
+ "Can't insert OpStore right before the function call");
// Insert an OpStore before the OpFunctionCall. +1 since the first
// operand of OpFunctionCall is an id of the function.
inst->InsertBefore(MakeUnique<opt::Instruction>(
- ir_context, SpvOpStore, 0, 0,
+ ir_context, spv::Op::OpStore, 0, 0,
opt::Instruction::OperandList{
{SPV_OPERAND_TYPE_ID, {message_.global_variable_fresh_id()}},
{SPV_OPERAND_TYPE_ID,