Validator cfg fixes
authorDavid Neto <dneto@google.com>
Fri, 5 Aug 2016 15:14:21 +0000 (11:14 -0400)
committerDavid Neto <dneto@google.com>
Fri, 5 Aug 2016 19:15:37 +0000 (15:15 -0400)
commitb51b80980c57b61b061aa203a9d481e51af2c5cd
tree7539b0ab60e22555abb803ad6fec84ea653545ee
parent3bf4dc102f4ffa2262b9a8d678d732ce66b08f81
Validator cfg fixes

- Find unreachable continue targets.  Look for back edges
  with a DFS traversal separate from the dominance traversals,
  where we count the OpLoopMerge from the header to the continue
  target as an edge in the graph.

- It's ok for a loop to have multiple back edges, provided
  they are all from the same block, and we call that the latch block.
  This may require a clarification/fix in the SPIR-V spec.

- Compute postdominance correctly for infinite loop:
  Bias *predecessor* traversal root finding so that you use
  a later block in the original list.  This ensures that
  for certain simple infinite loops in the CFG where neither
  block branches to a node without successors, that we'll
  compute the loop header as dominating the latch block, and the
  latch block as postdominating the loop header.
source/val/Function.cpp
source/val/Function.h
source/validate_cfg.cpp
test/Validate.CFG.cpp