aboutsummaryrefslogtreecommitdiff
path: root/source/fuzz/transformation_replace_opselect_with_conditional_branch.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_opselect_with_conditional_branch.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_opselect_with_conditional_branch.cpp')
-rw-r--r--source/fuzz/transformation_replace_opselect_with_conditional_branch.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/source/fuzz/transformation_replace_opselect_with_conditional_branch.cpp b/source/fuzz/transformation_replace_opselect_with_conditional_branch.cpp
index c0e6e449..b2010a94 100644
--- a/source/fuzz/transformation_replace_opselect_with_conditional_branch.cpp
+++ b/source/fuzz/transformation_replace_opselect_with_conditional_branch.cpp
@@ -50,7 +50,7 @@ bool TransformationReplaceOpSelectWithConditionalBranch::IsApplicable(
ir_context->get_def_use_mgr()->GetDef(message_.select_id());
// The instruction must exist and it must be an OpSelect instruction.
- if (!instruction || instruction->opcode() != SpvOpSelect) {
+ if (!instruction || instruction->opcode() != spv::Op::OpSelect) {
return false;
}
@@ -90,7 +90,7 @@ bool TransformationReplaceOpSelectWithConditionalBranch::IsApplicable(
// The predecessor must not be the header of a construct and it must end with
// OpBranch.
if (predecessor->GetMergeInst() != nullptr ||
- predecessor->terminator()->opcode() != SpvOpBranch) {
+ predecessor->terminator()->opcode() != spv::Op::OpBranch) {
return false;
}
@@ -115,13 +115,14 @@ void TransformationReplaceOpSelectWithConditionalBranch::Apply(
fuzzerutil::UpdateModuleIdBound(ir_context, id);
// Create the new block.
- auto new_block = MakeUnique<opt::BasicBlock>(MakeUnique<opt::Instruction>(
- ir_context, SpvOpLabel, 0, id, opt::Instruction::OperandList{}));
+ auto new_block = MakeUnique<opt::BasicBlock>(
+ MakeUnique<opt::Instruction>(ir_context, spv::Op::OpLabel, 0, id,
+ opt::Instruction::OperandList{}));
// Add an unconditional branch from the new block to the instruction
// block.
new_block->AddInstruction(MakeUnique<opt::Instruction>(
- ir_context, SpvOpBranch, 0, 0,
+ ir_context, spv::Op::OpBranch, 0, 0,
opt::Instruction::OperandList{{SPV_OPERAND_TYPE_ID, {block->id()}}}));
// Insert the new block right after the predecessor of the instruction
@@ -136,10 +137,11 @@ void TransformationReplaceOpSelectWithConditionalBranch::Apply(
// Add an OpSelectionMerge instruction to the predecessor block, where the
// merge block is the instruction block.
predecessor->AddInstruction(MakeUnique<opt::Instruction>(
- ir_context, SpvOpSelectionMerge, 0, 0,
- opt::Instruction::OperandList{{SPV_OPERAND_TYPE_ID, {block->id()}},
- {SPV_OPERAND_TYPE_SELECTION_CONTROL,
- {SpvSelectionControlMaskNone}}}));
+ ir_context, spv::Op::OpSelectionMerge, 0, 0,
+ opt::Instruction::OperandList{
+ {SPV_OPERAND_TYPE_ID, {block->id()}},
+ {SPV_OPERAND_TYPE_SELECTION_CONTROL,
+ {uint32_t(spv::SelectionControlMask::MaskNone)}}}));
// |if_block| will be the true block, if it has been created, the instruction
// block otherwise.
@@ -158,7 +160,7 @@ void TransformationReplaceOpSelectWithConditionalBranch::Apply(
// Add a conditional branching instruction to the predecessor, branching to
// |if_block| if the condition is true and to |if_false| otherwise.
predecessor->AddInstruction(MakeUnique<opt::Instruction>(
- ir_context, SpvOpBranchConditional, 0, 0,
+ ir_context, spv::Op::OpBranchConditional, 0, 0,
opt::Instruction::OperandList{
{SPV_OPERAND_TYPE_ID, {instruction->GetSingleWordInOperand(0)}},
{SPV_OPERAND_TYPE_ID, {if_block}},
@@ -177,7 +179,7 @@ void TransformationReplaceOpSelectWithConditionalBranch::Apply(
// Replace the OpSelect instruction in the merge block with an OpPhi.
// This: OpSelect %type %cond %if %else
// will become: OpPhi %type %if %if_pred %else %else_pred
- instruction->SetOpcode(SpvOpPhi);
+ instruction->SetOpcode(spv::Op::OpPhi);
std::vector<opt::Operand> operands;
operands.emplace_back(instruction->GetInOperand(1));