summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ast_utils.h1
-rw-r--r--test/min.fromasm.imprecise.no-opts30
-rw-r--r--test/min.fromasm.no-opts30
-rw-r--r--test/unit.fromasm.imprecise.no-opts118
-rw-r--r--test/unit.fromasm.no-opts118
5 files changed, 129 insertions, 168 deletions
diff --git a/src/ast_utils.h b/src/ast_utils.h
index f68f776af..2be0196ad 100644
--- a/src/ast_utils.h
+++ b/src/ast_utils.h
@@ -808,6 +808,7 @@ struct AutoDrop : public WalkerPass<ExpressionStackWalker<AutoDrop, Visitor<Auto
curr->list.back() = Builder(*getModule()).makeDrop(last);
}
expressionStack.pop_back();
+ curr->finalize(); // we may have changed our type
}
void visitFunction(Function* curr) {
diff --git a/test/min.fromasm.imprecise.no-opts b/test/min.fromasm.imprecise.no-opts
index 899bf5317..4563ef382 100644
--- a/test/min.fromasm.imprecise.no-opts
+++ b/test/min.fromasm.imprecise.no-opts
@@ -33,26 +33,22 @@
)
(func $bitcasts (param $i i32) (param $f f32)
(drop
- (block
- (drop
- (f32.reinterpret/i32
- (get_local $i)
- )
- )
- (drop
- (f64.promote/f32
- (f32.reinterpret/i32
- (get_local $i)
- )
- )
- )
- (drop
- (i32.reinterpret/f32
- (get_local $f)
- )
+ (f32.reinterpret/i32
+ (get_local $i)
+ )
+ )
+ (drop
+ (f64.promote/f32
+ (f32.reinterpret/i32
+ (get_local $i)
)
)
)
+ (drop
+ (i32.reinterpret/f32
+ (get_local $f)
+ )
+ )
)
(func $ctzzzz (result i32)
(return
diff --git a/test/min.fromasm.no-opts b/test/min.fromasm.no-opts
index 899bf5317..4563ef382 100644
--- a/test/min.fromasm.no-opts
+++ b/test/min.fromasm.no-opts
@@ -33,26 +33,22 @@
)
(func $bitcasts (param $i i32) (param $f f32)
(drop
- (block
- (drop
- (f32.reinterpret/i32
- (get_local $i)
- )
- )
- (drop
- (f64.promote/f32
- (f32.reinterpret/i32
- (get_local $i)
- )
- )
- )
- (drop
- (i32.reinterpret/f32
- (get_local $f)
- )
+ (f32.reinterpret/i32
+ (get_local $i)
+ )
+ )
+ (drop
+ (f64.promote/f32
+ (f32.reinterpret/i32
+ (get_local $i)
)
)
)
+ (drop
+ (i32.reinterpret/f32
+ (get_local $f)
+ )
+ )
)
(func $ctzzzz (result i32)
(return
diff --git a/test/unit.fromasm.imprecise.no-opts b/test/unit.fromasm.imprecise.no-opts
index 06ab8089b..f8f028164 100644
--- a/test/unit.fromasm.imprecise.no-opts
+++ b/test/unit.fromasm.imprecise.no-opts
@@ -349,29 +349,25 @@
(local $y f32)
(local $z f64)
(drop
- (block
- (drop
- (f32.demote/f64
- (get_local $z)
- )
- )
- (drop
- (get_local $y)
- )
- (drop
- (f32.const 5)
- )
- (drop
- (f32.const 0)
- )
- (drop
- (f32.const 5)
- )
- (drop
- (f32.const 0)
- )
+ (f32.demote/f64
+ (get_local $z)
)
)
+ (drop
+ (get_local $y)
+ )
+ (drop
+ (f32.const 5)
+ )
+ (drop
+ (f32.const 0)
+ )
+ (drop
+ (f32.const 5)
+ )
+ (drop
+ (f32.const 0)
+ )
)
(func $negZero (result f64)
(return
@@ -591,30 +587,26 @@
(func $bitcasts (param $i i32) (param $f f32)
(local $d f64)
(drop
- (block
- (drop
- (f32.reinterpret/i32
- (get_local $i)
- )
- )
- (drop
- (f64.promote/f32
- (f32.reinterpret/i32
- (get_local $i)
- )
- )
- )
- (drop
- (i32.reinterpret/f32
- (get_local $f)
- )
+ (f32.reinterpret/i32
+ (get_local $i)
+ )
+ )
+ (drop
+ (f64.promote/f32
+ (f32.reinterpret/i32
+ (get_local $i)
)
- (drop
- (i32.reinterpret/f32
- (f32.demote/f64
- (get_local $d)
- )
- )
+ )
+ )
+ (drop
+ (i32.reinterpret/f32
+ (get_local $f)
+ )
+ )
+ (drop
+ (i32.reinterpret/f32
+ (f32.demote/f64
+ (get_local $d)
)
)
)
@@ -639,22 +631,18 @@
)
)
(block
- (drop
+ (block
(block
(drop
- (block
- (drop
- (i32.const 4)
- )
- (drop
- (i32.const 5)
- )
- )
+ (i32.const 4)
)
(drop
- (i32.const 6)
+ (i32.const 5)
)
)
+ (drop
+ (i32.const 6)
+ )
)
(i32.const 7)
)
@@ -707,28 +695,24 @@
)
)
(block
- (drop
+ (block
(block
(drop
- (block
- (drop
- (call $lb
- (i32.const 4)
- )
- )
- (drop
- (call $lb
- (i32.const 5)
- )
- )
+ (call $lb
+ (i32.const 4)
)
)
(drop
(call $lb
- (i32.const 6)
+ (i32.const 5)
)
)
)
+ (drop
+ (call $lb
+ (i32.const 6)
+ )
+ )
)
(call $lb
(i32.const 7)
diff --git a/test/unit.fromasm.no-opts b/test/unit.fromasm.no-opts
index 169d4fe5b..650f20c51 100644
--- a/test/unit.fromasm.no-opts
+++ b/test/unit.fromasm.no-opts
@@ -355,29 +355,25 @@
(local $y f32)
(local $z f64)
(drop
- (block
- (drop
- (f32.demote/f64
- (get_local $z)
- )
- )
- (drop
- (get_local $y)
- )
- (drop
- (f32.const 5)
- )
- (drop
- (f32.const 0)
- )
- (drop
- (f32.const 5)
- )
- (drop
- (f32.const 0)
- )
+ (f32.demote/f64
+ (get_local $z)
)
)
+ (drop
+ (get_local $y)
+ )
+ (drop
+ (f32.const 5)
+ )
+ (drop
+ (f32.const 0)
+ )
+ (drop
+ (f32.const 5)
+ )
+ (drop
+ (f32.const 0)
+ )
)
(func $negZero (result f64)
(return
@@ -597,30 +593,26 @@
(func $bitcasts (param $i i32) (param $f f32)
(local $d f64)
(drop
- (block
- (drop
- (f32.reinterpret/i32
- (get_local $i)
- )
- )
- (drop
- (f64.promote/f32
- (f32.reinterpret/i32
- (get_local $i)
- )
- )
- )
- (drop
- (i32.reinterpret/f32
- (get_local $f)
- )
+ (f32.reinterpret/i32
+ (get_local $i)
+ )
+ )
+ (drop
+ (f64.promote/f32
+ (f32.reinterpret/i32
+ (get_local $i)
)
- (drop
- (i32.reinterpret/f32
- (f32.demote/f64
- (get_local $d)
- )
- )
+ )
+ )
+ (drop
+ (i32.reinterpret/f32
+ (get_local $f)
+ )
+ )
+ (drop
+ (i32.reinterpret/f32
+ (f32.demote/f64
+ (get_local $d)
)
)
)
@@ -645,22 +637,18 @@
)
)
(block
- (drop
+ (block
(block
(drop
- (block
- (drop
- (i32.const 4)
- )
- (drop
- (i32.const 5)
- )
- )
+ (i32.const 4)
)
(drop
- (i32.const 6)
+ (i32.const 5)
)
)
+ (drop
+ (i32.const 6)
+ )
)
(i32.const 7)
)
@@ -713,28 +701,24 @@
)
)
(block
- (drop
+ (block
(block
(drop
- (block
- (drop
- (call $lb
- (i32.const 4)
- )
- )
- (drop
- (call $lb
- (i32.const 5)
- )
- )
+ (call $lb
+ (i32.const 4)
)
)
(drop
(call $lb
- (i32.const 6)
+ (i32.const 5)
)
)
)
+ (drop
+ (call $lb
+ (i32.const 6)
+ )
+ )
)
(call $lb
(i32.const 7)