summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wasm-s-parser.h7
-rw-r--r--src/wasm.h2
-rw-r--r--test/llvm_autogenerated/cfg-stackify.wast2
-rw-r--r--test/llvm_autogenerated/switch.wast4
4 files changed, 5 insertions, 10 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index afcc8e2ec..719a6598b 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -923,12 +923,7 @@ private:
ret->targets.push_back(curr[1]->str());
}
Element& curr = *s[i];
- if (curr[0]->str() == CASE) {
- ret->default_ = curr[1]->str();
- } else {
- assert(curr[0]->str() == BR);
- assert(curr[1]->str() == ret->name);
- }
+ ret->default_ = curr[1]->str();
i++;
for (; i < s.size(); i++) {
Element& curr = *s[i];
diff --git a/src/wasm.h b/src/wasm.h
index 55cc75cf9..b1b8d84d4 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -474,7 +474,7 @@ public:
o << " (" << (caseNames.count(t) == 0 ? "br" : "case") << " " << (t.is() ? t : default_) << ")";
}
o << ")";
- if (default_.is()) o << " (case " << default_ << ")";
+ if (default_.is()) o << " (" << (caseNames.count(default_) == 0 ? "br" : "case") << " " << default_ << ")";
o << "\n";
for (auto& c : cases) {
doIndent(o, indent);
diff --git a/test/llvm_autogenerated/cfg-stackify.wast b/test/llvm_autogenerated/cfg-stackify.wast
index fabeb3816..984eecc4c 100644
--- a/test/llvm_autogenerated/cfg-stackify.wast
+++ b/test/llvm_autogenerated/cfg-stackify.wast
@@ -911,7 +911,7 @@
)
(tableswitch
(get_local $$2)
- (table (br $.LBB19_3) (br $.LBB19_5) (br $.LBB19_1) (br $.LBB19_2) (br $.LBB19_6)) (case $.LBB19_3)
+ (table (br $.LBB19_3) (br $.LBB19_5) (br $.LBB19_1) (br $.LBB19_2) (br $.LBB19_6)) (br $.LBB19_3)
)
)
)
diff --git a/test/llvm_autogenerated/switch.wast b/test/llvm_autogenerated/switch.wast
index 665909bb5..69d6db9f1 100644
--- a/test/llvm_autogenerated/switch.wast
+++ b/test/llvm_autogenerated/switch.wast
@@ -27,7 +27,7 @@
(block $.LBB0_2
(tableswitch
(get_local $$0)
- (table (br $.LBB0_2) (br $.LBB0_2) (br $.LBB0_2) (br $.LBB0_2) (br $.LBB0_2) (br $.LBB0_2) (br $.LBB0_2) (br $.LBB0_3) (br $.LBB0_3) (br $.LBB0_3) (br $.LBB0_3) (br $.LBB0_3) (br $.LBB0_3) (br $.LBB0_3) (br $.LBB0_3) (br $.LBB0_4) (br $.LBB0_4) (br $.LBB0_4) (br $.LBB0_4) (br $.LBB0_4) (br $.LBB0_4) (br $.LBB0_5) (br $.LBB0_6) (br $.LBB0_7)) (case $.LBB0_2)
+ (table (br $.LBB0_2) (br $.LBB0_2) (br $.LBB0_2) (br $.LBB0_2) (br $.LBB0_2) (br $.LBB0_2) (br $.LBB0_2) (br $.LBB0_3) (br $.LBB0_3) (br $.LBB0_3) (br $.LBB0_3) (br $.LBB0_3) (br $.LBB0_3) (br $.LBB0_3) (br $.LBB0_3) (br $.LBB0_4) (br $.LBB0_4) (br $.LBB0_4) (br $.LBB0_4) (br $.LBB0_4) (br $.LBB0_4) (br $.LBB0_5) (br $.LBB0_6) (br $.LBB0_7)) (br $.LBB0_2)
)
)
(call_import $foo0)
@@ -72,7 +72,7 @@
(i32.wrap/i64
(get_local $$0)
)
- (table (br $.LBB1_2) (br $.LBB1_2) (br $.LBB1_2) (br $.LBB1_2) (br $.LBB1_2) (br $.LBB1_2) (br $.LBB1_2) (br $.LBB1_3) (br $.LBB1_3) (br $.LBB1_3) (br $.LBB1_3) (br $.LBB1_3) (br $.LBB1_3) (br $.LBB1_3) (br $.LBB1_3) (br $.LBB1_4) (br $.LBB1_4) (br $.LBB1_4) (br $.LBB1_4) (br $.LBB1_4) (br $.LBB1_4) (br $.LBB1_5) (br $.LBB1_6) (br $.LBB1_7)) (case $.LBB1_2)
+ (table (br $.LBB1_2) (br $.LBB1_2) (br $.LBB1_2) (br $.LBB1_2) (br $.LBB1_2) (br $.LBB1_2) (br $.LBB1_2) (br $.LBB1_3) (br $.LBB1_3) (br $.LBB1_3) (br $.LBB1_3) (br $.LBB1_3) (br $.LBB1_3) (br $.LBB1_3) (br $.LBB1_3) (br $.LBB1_4) (br $.LBB1_4) (br $.LBB1_4) (br $.LBB1_4) (br $.LBB1_4) (br $.LBB1_4) (br $.LBB1_5) (br $.LBB1_6) (br $.LBB1_7)) (br $.LBB1_2)
)
)
(call_import $foo0)