[PATCH] D53620: [WebAssembly] Error out when block/loop markers mismatch
Heejin Ahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 25 16:11:21 PDT 2018
aheejin updated this revision to Diff 171213.
aheejin added a comment.
- Address comments
- Tidy up test case
- Delete test case. Assertions can't be tested.
Repository:
rL LLVM
https://reviews.llvm.org/D53620
Files:
lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp
Index: lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp
===================================================================
--- lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp
+++ lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp
@@ -85,16 +85,14 @@
break;
case WebAssembly::END_LOOP:
case WebAssembly::END_LOOP_S:
- // Have to guard against an empty stack, in case of mismatched pairs
- // in assembly parsing.
- if (!ControlFlowStack.empty())
- ControlFlowStack.pop_back();
+ assert(!ControlFlowStack.empty() && "End marker mismatch!");
+ ControlFlowStack.pop_back();
break;
case WebAssembly::END_BLOCK:
case WebAssembly::END_BLOCK_S:
- if (!ControlFlowStack.empty())
- printAnnotation(
- OS, "label" + utostr(ControlFlowStack.pop_back_val().first) + ':');
+ assert(!ControlFlowStack.empty() && "End marker mismatch!");
+ printAnnotation(
+ OS, "label" + utostr(ControlFlowStack.pop_back_val().first) + ':');
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53620.171213.patch
Type: text/x-patch
Size: 1081 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181025/3c99e778/attachment.bin>
More information about the llvm-commits
mailing list