aboutsummaryrefslogtreecommitdiff
path: root/source/opt/strip_nonsemantic_info_pass.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/opt/strip_nonsemantic_info_pass.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/opt/strip_nonsemantic_info_pass.cpp')
-rw-r--r--source/opt/strip_nonsemantic_info_pass.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/source/opt/strip_nonsemantic_info_pass.cpp b/source/opt/strip_nonsemantic_info_pass.cpp
index cd1fbb63..88996900 100644
--- a/source/opt/strip_nonsemantic_info_pass.cpp
+++ b/source/opt/strip_nonsemantic_info_pass.cpp
@@ -32,27 +32,31 @@ Pass::Status StripNonSemanticInfoPass::Process() {
bool other_uses_for_decorate_string = false;
for (auto& inst : context()->module()->annotations()) {
switch (inst.opcode()) {
- case SpvOpDecorateStringGOOGLE:
- if (inst.GetSingleWordInOperand(1) == SpvDecorationHlslSemanticGOOGLE ||
- inst.GetSingleWordInOperand(1) == SpvDecorationUserTypeGOOGLE) {
+ case spv::Op::OpDecorateStringGOOGLE:
+ if (spv::Decoration(inst.GetSingleWordInOperand(1)) ==
+ spv::Decoration::HlslSemanticGOOGLE ||
+ spv::Decoration(inst.GetSingleWordInOperand(1)) ==
+ spv::Decoration::UserTypeGOOGLE) {
to_remove.push_back(&inst);
} else {
other_uses_for_decorate_string = true;
}
break;
- case SpvOpMemberDecorateStringGOOGLE:
- if (inst.GetSingleWordInOperand(2) == SpvDecorationHlslSemanticGOOGLE ||
- inst.GetSingleWordInOperand(2) == SpvDecorationUserTypeGOOGLE) {
+ case spv::Op::OpMemberDecorateStringGOOGLE:
+ if (spv::Decoration(inst.GetSingleWordInOperand(2)) ==
+ spv::Decoration::HlslSemanticGOOGLE ||
+ spv::Decoration(inst.GetSingleWordInOperand(2)) ==
+ spv::Decoration::UserTypeGOOGLE) {
to_remove.push_back(&inst);
} else {
other_uses_for_decorate_string = true;
}
break;
- case SpvOpDecorateId:
- if (inst.GetSingleWordInOperand(1) ==
- SpvDecorationHlslCounterBufferGOOGLE) {
+ case spv::Op::OpDecorateId:
+ if (spv::Decoration(inst.GetSingleWordInOperand(1)) ==
+ spv::Decoration::HlslCounterBufferGOOGLE) {
to_remove.push_back(&inst);
}
break;
@@ -79,7 +83,7 @@ Pass::Status StripNonSemanticInfoPass::Process() {
// remove any extended inst imports that are non semantic
std::unordered_set<uint32_t> non_semantic_sets;
for (auto& inst : context()->module()->ext_inst_imports()) {
- assert(inst.opcode() == SpvOpExtInstImport &&
+ assert(inst.opcode() == spv::Op::OpExtInstImport &&
"Expecting an import of an extension's instruction set.");
const std::string extension_name = inst.GetInOperand(0).AsString();
if (spvtools::utils::starts_with(extension_name, "NonSemantic.")) {
@@ -93,7 +97,7 @@ Pass::Status StripNonSemanticInfoPass::Process() {
if (!non_semantic_sets.empty()) {
context()->module()->ForEachInst(
[&non_semantic_sets, &to_remove](Instruction* inst) {
- if (inst->opcode() == SpvOpExtInst) {
+ if (inst->opcode() == spv::Op::OpExtInst) {
if (non_semantic_sets.find(inst->GetSingleWordInOperand(0)) !=
non_semantic_sets.end()) {
to_remove.push_back(inst);