aboutsummaryrefslogtreecommitdiff
path: root/source/opt/local_single_store_elim_pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/opt/local_single_store_elim_pass.cpp')
-rw-r--r--source/opt/local_single_store_elim_pass.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/source/opt/local_single_store_elim_pass.cpp b/source/opt/local_single_store_elim_pass.cpp
index 9701d10e..051bcada 100644
--- a/source/opt/local_single_store_elim_pass.cpp
+++ b/source/opt/local_single_store_elim_pass.cpp
@@ -53,6 +53,20 @@ bool LocalSingleStoreElimPass::AllExtensionsSupported() const {
if (extensions_allowlist_.find(extName) == extensions_allowlist_.end())
return false;
}
+ // only allow NonSemantic.Shader.DebugInfo.100, we cannot safely optimise
+ // around unknown extended
+ // instruction sets even if they are non-semantic
+ for (auto& inst : context()->module()->ext_inst_imports()) {
+ assert(inst.opcode() == SpvOpExtInstImport &&
+ "Expecting an import of an extension's instruction set.");
+ const char* extension_name =
+ reinterpret_cast<const char*>(&inst.GetInOperand(0).words[0]);
+ if (0 == std::strncmp(extension_name, "NonSemantic.", 12) &&
+ 0 != std::strncmp(extension_name, "NonSemantic.Shader.DebugInfo.100",
+ 32)) {
+ return false;
+ }
+ }
return true;
}
@@ -67,7 +81,7 @@ Pass::Status LocalSingleStoreElimPass::ProcessImpl() {
ProcessFunction pfn = [this](Function* fp) {
return LocalSingleStoreElim(fp);
};
- bool modified = context()->ProcessEntryPointCallTree(pfn);
+ bool modified = context()->ProcessReachableCallTree(pfn);
return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange;
}
@@ -126,6 +140,7 @@ void LocalSingleStoreElimPass::InitExtensionAllowList() {
"SPV_KHR_subgroup_uniform_control_flow",
"SPV_KHR_integer_dot_product",
"SPV_EXT_shader_image_int64",
+ "SPV_KHR_non_semantic_info",
});
}
bool LocalSingleStoreElimPass::ProcessVariable(Instruction* var_inst) {