summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-02-18 13:45:42 -0800
committerAlon Zakai <alonzakai@gmail.com>2016-02-18 13:45:42 -0800
commit47b9763af12799e1845677106de1f9c0a00ee2c4 (patch)
treeaf81cd091f0b9d1b7cd9e669981d7280c911379c
parent1547a9c0c6b702d86b4efb584c910ffbc0fb6b23 (diff)
downloadbinaryen-47b9763af12799e1845677106de1f9c0a00ee2c4.tar.gz
binaryen-47b9763af12799e1845677106de1f9c0a00ee2c4.tar.bz2
binaryen-47b9763af12799e1845677106de1f9c0a00ee2c4.zip
fix the topmost/switch label in LowerCase
-rw-r--r--src/passes/LowerCase.cpp3
-rw-r--r--test/passes/lower-case.txt12
2 files changed, 8 insertions, 7 deletions
diff --git a/src/passes/LowerCase.cpp b/src/passes/LowerCase.cpp
index a17b97981..f890de411 100644
--- a/src/passes/LowerCase.cpp
+++ b/src/passes/LowerCase.cpp
@@ -92,7 +92,8 @@ struct LowerCase : public WalkerPass<WasmWalker<LowerCase, void>> {
top = next;
}
curr->cases.clear();
- top->name = Name(std::string("forswitch$") + curr->name.str);
+ top->name = curr->name;
+ curr->name = Name();
replaceCurrent(top);
}
};
diff --git a/test/passes/lower-case.txt b/test/passes/lower-case.txt
index 82651da23..8c1ea176f 100644
--- a/test/passes/lower-case.txt
+++ b/test/passes/lower-case.txt
@@ -1,11 +1,11 @@
(module
(memory 0)
(func $switcher (param $x i32) (result i32)
- (block $forswitch$switch$0
+ (block $switch$0
(block $switch-default$3
(block $switch-case$2
(block $switch-case$1
- (tableswitch $switch$0
+ (tableswitch
(i32.sub
(get_local $x)
(i32.const 1)
@@ -23,11 +23,11 @@
)
(nop)
)
- (block $forswitch$switch$4
+ (block $switch$4
(block $switch-default$7
(block $switch-case$6
(block $switch-case$5
- (tableswitch $switch$4
+ (tableswitch
(i32.sub
(get_local $x)
(i32.const 5)
@@ -45,13 +45,13 @@
)
(nop)
)
- (block $forswitch$label$break$Lout
+ (block $label$break$Lout
(block $switch-default$16
(block $switch-case$15
(block $switch-case$12
(block $switch-case$9
(block $switch-case$8
- (tableswitch $label$break$Lout
+ (tableswitch
(i32.sub
(get_local $x)
(i32.const 2)