Don't remove SPIR-V blocks before codegen.

A removed block releases its instructions, so Module::idToInstruction
suddenly contains dangling references.  The original motivation for
block removal was to skip some unreachable blocks, but that's already
achieved by InReadableOrder.cpp.

Also updated stale comments.
This commit is contained in:
Dejan Mircevski
2016-01-19 21:13:38 -05:00
parent 33782795d9
commit ed55bcd9f8
17 changed files with 1233 additions and 1252 deletions

View File

@@ -205,12 +205,6 @@ public:
void dump(std::vector<unsigned int>& out) const
{
// skip the degenerate unreachable blocks
// TODO: code gen: skip all unreachable blocks (transitive closure)
// (but, until that's done safer to keep non-degenerate unreachable blocks, in case others depend on something)
if (unreachable && instructions.size() <= 2)
return;
instructions[0]->dump(out);
for (int i = 0; i < (int)localVariables.size(); ++i)
localVariables[i]->dump(out);