summaryrefslogtreecommitdiff
path: root/src/ir/ReFinalize.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-12-04 13:04:57 -0800
committerGitHub <noreply@github.com>2019-12-04 13:04:57 -0800
commit4056443a5c926ac009b455bf6774445edb6050ba (patch)
tree4b6c17d538bcfc1637289fc78bfb296da4aab482 /src/ir/ReFinalize.cpp
parenta2f1a6375a596b3dea6fa615f6ff544c368c3991 (diff)
downloadbinaryen-4056443a5c926ac009b455bf6774445edb6050ba.tar.gz
binaryen-4056443a5c926ac009b455bf6774445edb6050ba.tar.bz2
binaryen-4056443a5c926ac009b455bf6774445edb6050ba.zip
Remove 'none' type as a branch target in ReFinalize (#2492)
That was needed for super-old wasm type system, where we allowed (block $x (br_if $x (unreachable) (nop) ) ) That is, we differentiated "taken" branches from "named" ones (just referred to by name, but not actually taken as it's in unreachable code). We don't need to differentiate those any more. Remove the ReFinalize code that considered it, and also remove the named/taken distinction in other places.
Diffstat (limited to 'src/ir/ReFinalize.cpp')
-rw-r--r--src/ir/ReFinalize.cpp29
1 files changed, 0 insertions, 29 deletions
diff --git a/src/ir/ReFinalize.cpp b/src/ir/ReFinalize.cpp
index 007a7ee55..bc5522c10 100644
--- a/src/ir/ReFinalize.cpp
+++ b/src/ir/ReFinalize.cpp
@@ -44,41 +44,12 @@ void ReFinalize::visitBlock(Block* curr) {
curr->type = none;
return;
}
- auto old = curr->type;
// do this quickly, without any validation
// last element determines type
curr->type = curr->list.back()->type;
// if concrete, it doesn't matter if we have an unreachable child, and we
// don't need to look at breaks
if (curr->type.isConcrete()) {
- // make sure our branches make sense for us - we may have just made
- // ourselves concrete for a value flowing out, while branches did not send a
- // value. such branches could not have been actually taken before, that is,
- // there were in unreachable code, but we do still need to fix them up here.
- if (!old.isConcrete()) {
- auto iter = breakValues.find(curr->name);
- if (iter != breakValues.end()) {
- // there is a break to here
- auto type = iter->second;
- if (type == none) {
- // we need to fix this up. set the values to unreachables
- // note that we don't need to handle br_on_exn here, because its value
- // type is never none
- for (auto* br : FindAll<Break>(curr).list) {
- handleBranchForVisitBlock(br, curr->name, getModule());
- }
- for (auto* sw : FindAll<Switch>(curr).list) {
- handleBranchForVisitBlock(sw, curr->name, getModule());
- }
- // and we need to propagate that type out, re-walk
- ReFinalize fixer;
- fixer.setModule(getModule());
- Expression* temp = curr;
- fixer.walk(temp);
- assert(temp == curr);
- }
- }
- }
return;
}
// otherwise, we have no final fallthrough element to determine the type,