[WebAssembly] Add an assertion for an invalid CFG

Summary:
It was not easy to provide a test case for D45648 (rL330079) because the bug
didn't manifest itself in the set of currently valid IRs. Added an assertion to
check this faster, thanks to @dblaikie's suggestion.

Reviewers: dblaikie

Subscribers: jfb, dschuff, sbc100, jgravelle-google, llvm-commits, dblaikie

Differential Revision: https://reviews.llvm.org/D45711

llvm-svn: 330217
This commit is contained in:
Heejin Ahn 2018-04-17 21:19:21 +00:00
parent e6ac9f5ec3
commit 2b8158f441
1 changed files with 3 additions and 0 deletions

View File

@ -145,6 +145,9 @@ static void PlaceBlockMarker(
std::prev(InsertPos)->getOpcode() != WebAssembly::END_LOOP) std::prev(InsertPos)->getOpcode() != WebAssembly::END_LOOP)
--InsertPos; --InsertPos;
} }
// The header block in which a 'block' mark will be inserted should have a
// terminator because it is branching to a non-layout successor.
assert(InsertPos != Header->end());
// Add the BLOCK. // Add the BLOCK.
MachineInstr *Begin = MachineInstr *Begin =