diff options
author | David Neto <dneto@google.com> | 2017-02-09 14:23:52 -0500 |
---|---|---|
committer | David Neto <dneto@google.com> | 2017-02-10 12:26:10 -0500 |
commit | dadd5161bb37c3a190daf4eae24dcebe816f39a4 (patch) | |
tree | 7e56a6169d9302630ef5e3448b93523d465d3e44 /source/val/construct.h | |
parent | f2867d748531aa22f56d7ce6cdf06c881322df14 (diff) |
Check strict domination of merge block
If a merge block is reachable, then it must be *strictly* dominated
by its header. Until now we've allowed the header and the merge
block to be the same.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/551
Also: Use dominates and postdominates methods on BasicBlock to
improve readability.
Diffstat (limited to 'source/val/construct.h')
-rw-r--r-- | source/val/construct.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/val/construct.h b/source/val/construct.h index c8997959..bca87d63 100644 --- a/source/val/construct.h +++ b/source/val/construct.h @@ -85,6 +85,12 @@ class Construct { /// constructs which do not know the back-edge block during construction void set_exit(BasicBlock* exit_block); + // Returns whether the exit block of this construct is the merge block + // for an OpLoopMerge or OpSelectionMerge + bool ExitBlockIsMergeBlock() const { + return type_ == ConstructType::kLoop || type_ == ConstructType::kSelection; + } + private: /// The type of the construct ConstructType type_; |