aboutsummaryrefslogtreecommitdiff
path: root/source/val/validate_cfg.cpp
diff options
context:
space:
mode:
authoralan-baker <alanbaker@google.com>2020-01-23 18:04:21 -0500
committerGitHub <noreply@github.com>2020-01-23 18:04:21 -0500
commit6729c4a7ce98bc5d1b6e1d3a36c6c9ccf87d8966 (patch)
treebdda53a9ef024fc18f9ca79a66f434b69c201dea /source/val/validate_cfg.cpp
parentbb236c326d8ec3ea5810f54640ed6d512fb72ecc (diff)
downloadSPIRV-Tools-6729c4a7ce98bc5d1b6e1d3a36c6c9ccf87d8966.tar.gz
Fix structured exit validation (#3141)
Fixes #3139 * If the header of the construct is also a merge block, jump to the associated header instead of the immediate dominator * prevents spurious failures from unrelated constructs * new tests
Diffstat (limited to 'source/val/validate_cfg.cpp')
-rw-r--r--source/val/validate_cfg.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/val/validate_cfg.cpp b/source/val/validate_cfg.cpp
index 43a6af7e..f3019d17 100644
--- a/source/val/validate_cfg.cpp
+++ b/source/val/validate_cfg.cpp
@@ -728,10 +728,10 @@ spv_result_t StructuredControlFlowChecks(
}
Construct::ConstructBlockSet construct_blocks = construct.blocks(function);
+ std::string construct_name, header_name, exit_name;
+ std::tie(construct_name, header_name, exit_name) =
+ ConstructNames(construct.type());
for (auto block : construct_blocks) {
- std::string construct_name, header_name, exit_name;
- std::tie(construct_name, header_name, exit_name) =
- ConstructNames(construct.type());
// Check that all exits from the construct are via structured exits.
for (auto succ : *block->successors()) {
if (block->reachable() && !construct_blocks.count(succ) &&