[llvm] r330217 - [WebAssembly] Add an assertion for an invalid CFG

Heejin Ahn via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 17 14:19:21 PDT 2018


Author: aheejin
Date: Tue Apr 17 14:19:21 2018
New Revision: 330217

URL: http://llvm.org/viewvc/llvm-project?rev=330217&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp

Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp?rev=330217&r1=330216&r2=330217&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp Tue Apr 17 14:19:21 2018
@@ -145,6 +145,9 @@ static void PlaceBlockMarker(
            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 =




More information about the llvm-commits mailing list