aboutsummaryrefslogtreecommitdiff
path: root/source/fuzz/transformation_load.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_load.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_load.cpp')
-rw-r--r--source/fuzz/transformation_load.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/source/fuzz/transformation_load.cpp b/source/fuzz/transformation_load.cpp
index bf48d996..1cfde770 100644
--- a/source/fuzz/transformation_load.cpp
+++ b/source/fuzz/transformation_load.cpp
@@ -52,15 +52,15 @@ bool TransformationLoad::IsApplicable(
// The type must indeed be a pointer type.
auto pointer_type = ir_context->get_def_use_mgr()->GetDef(pointer->type_id());
assert(pointer_type && "Type id must be defined.");
- if (pointer_type->opcode() != SpvOpTypePointer) {
+ if (pointer_type->opcode() != spv::Op::OpTypePointer) {
return false;
}
// We do not want to allow loading from null or undefined pointers, as it is
// not clear how punishing the consequences of doing so are from a semantics
// point of view.
switch (pointer->opcode()) {
- case SpvOpConstantNull:
- case SpvOpUndef:
+ case spv::Op::OpConstantNull:
+ case spv::Op::OpUndef:
return false;
default:
break;
@@ -74,13 +74,13 @@ bool TransformationLoad::IsApplicable(
return false;
}
// ... and it must be legitimate to insert a load before it.
- if (!message_.is_atomic() &&
- !fuzzerutil::CanInsertOpcodeBeforeInstruction(SpvOpLoad, insert_before)) {
+ if (!message_.is_atomic() && !fuzzerutil::CanInsertOpcodeBeforeInstruction(
+ spv::Op::OpLoad, insert_before)) {
return false;
}
if (message_.is_atomic() && !fuzzerutil::CanInsertOpcodeBeforeInstruction(
- SpvOpAtomicLoad, insert_before)) {
+ spv::Op::OpAtomicLoad, insert_before)) {
return false;
}
@@ -99,10 +99,10 @@ bool TransformationLoad::IsApplicable(
}
// The memory scope and memory semantics instructions must have the
// 'OpConstant' opcode.
- if (memory_scope_instruction->opcode() != SpvOpConstant) {
+ if (memory_scope_instruction->opcode() != spv::Op::OpConstant) {
return false;
}
- if (memory_semantics_instruction->opcode() != SpvOpConstant) {
+ if (memory_semantics_instruction->opcode() != spv::Op::OpConstant) {
return false;
}
// The memory scope and memory semantics need to be available before
@@ -119,12 +119,12 @@ bool TransformationLoad::IsApplicable(
// operand type with signedness does not matters.
if (ir_context->get_def_use_mgr()
->GetDef(memory_scope_instruction->type_id())
- ->opcode() != SpvOpTypeInt) {
+ ->opcode() != spv::Op::OpTypeInt) {
return false;
}
if (ir_context->get_def_use_mgr()
->GetDef(memory_semantics_instruction->type_id())
- ->opcode() != SpvOpTypeInt) {
+ ->opcode() != spv::Op::OpTypeInt) {
return false;
}
@@ -146,20 +146,20 @@ bool TransformationLoad::IsApplicable(
return false;
}
- // The memory scope constant value must be that of SpvScopeInvocation.
+ // The memory scope constant value must be that of spv::Scope::Invocation.
auto memory_scope_const_value =
- memory_scope_instruction->GetSingleWordInOperand(0);
- if (memory_scope_const_value != SpvScopeInvocation) {
+ spv::Scope(memory_scope_instruction->GetSingleWordInOperand(0));
+ if (memory_scope_const_value != spv::Scope::Invocation) {
return false;
}
// The memory semantics constant value must match the storage class of the
// pointer being loaded from.
- auto memory_semantics_const_value = static_cast<SpvMemorySemanticsMask>(
+ auto memory_semantics_const_value = static_cast<spv::MemorySemanticsMask>(
memory_semantics_instruction->GetSingleWordInOperand(0));
if (memory_semantics_const_value !=
fuzzerutil::GetMemorySemanticsForStorageClass(
- static_cast<SpvStorageClass>(
+ static_cast<spv::StorageClass>(
pointer_type->GetSingleWordInOperand(0)))) {
return false;
}
@@ -180,7 +180,7 @@ void TransformationLoad::Apply(opt::IRContext* ir_context,
auto insert_before =
FindInstruction(message_.instruction_to_insert_before(), ir_context);
auto new_instruction = MakeUnique<opt::Instruction>(
- ir_context, SpvOpAtomicLoad, result_type, message_.fresh_id(),
+ ir_context, spv::Op::OpAtomicLoad, result_type, message_.fresh_id(),
opt::Instruction::OperandList(
{{SPV_OPERAND_TYPE_ID, {message_.pointer_id()}},
{SPV_OPERAND_TYPE_SCOPE_ID, {message_.memory_scope_id()}},
@@ -201,7 +201,7 @@ void TransformationLoad::Apply(opt::IRContext* ir_context,
auto insert_before =
FindInstruction(message_.instruction_to_insert_before(), ir_context);
auto new_instruction = MakeUnique<opt::Instruction>(
- ir_context, SpvOpLoad, result_type, message_.fresh_id(),
+ ir_context, spv::Op::OpLoad, result_type, message_.fresh_id(),
opt::Instruction::OperandList(
{{SPV_OPERAND_TYPE_ID, {message_.pointer_id()}}}));
auto new_instruction_ptr = new_instruction.get();