[PATCH] D45711: [WebAssembly] Add an assertion for an invalid CFG

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 16 17:35:19 PDT 2018


aheejin created this revision.
aheejin added reviewers: sunfish, yurydelendik, dblaikie.
Herald added subscribers: llvm-commits, jgravelle-google, sbc100, dschuff, jfb.

It was not easy to provide a test case for https://reviews.llvm.org/D45648 (https://reviews.llvm.org/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.


Repository:
  rL LLVM

https://reviews.llvm.org/D45711

Files:
  lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp


Index: lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
===================================================================
--- lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
+++ lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
@@ -145,6 +145,9 @@
            std::prev(InsertPos)->getOpcode() != WebAssembly::END_LOOP)
       --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.
   MachineInstr *Begin =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45711.142724.patch
Type: text/x-patch
Size: 583 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180417/8d5dba22/attachment.bin>


More information about the llvm-commits mailing list