From a030cc7f69a00dc0e699b8b580224126650c738b Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 1 Nov 2022 16:20:06 -0700 Subject: [Wasm GC] SimplifyLocals: Switch local.get to use a more refined type when possible (#5194) (local.set $refined (cast (local.get $plain))) .. .. (local.get $plain) .. ;; we can change this to read from $refined By using the more refined type we may be able to eliminate casts later. To do this, look at the fallthrough value (so we can look through a cast or a block value - this is the reason for the small wasm2js improvements in tests), and also extend the code that picks which local index to read to look at types (previously we just ignored any pairs of locals with different types). --- test/wasm2js/float_literals-modified.2asm.js.opt | 54 ++++++++---------------- 1 file changed, 18 insertions(+), 36 deletions(-) (limited to 'test/wasm2js/float_literals-modified.2asm.js.opt') diff --git a/test/wasm2js/float_literals-modified.2asm.js.opt b/test/wasm2js/float_literals-modified.2asm.js.opt index 1e69b6304..613e52a40 100644 --- a/test/wasm2js/float_literals-modified.2asm.js.opt +++ b/test/wasm2js/float_literals-modified.2asm.js.opt @@ -108,9 +108,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } function legalstub$32() { @@ -119,9 +118,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } function legalstub$34() { @@ -130,9 +128,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } function legalstub$35() { @@ -141,9 +138,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } function legalstub$36() { @@ -152,9 +148,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } function legalstub$37() { @@ -163,9 +158,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } function legalstub$38() { @@ -174,9 +168,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } function legalstub$39() { @@ -185,9 +178,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } function legalstub$41() { @@ -196,9 +188,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } function legalstub$42() { @@ -207,9 +198,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } function legalstub$44() { @@ -218,9 +208,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } function legalstub$45() { @@ -229,9 +218,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } function legalstub$46() { @@ -240,9 +228,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } function legalstub$47() { @@ -251,9 +238,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } function legalstub$48() { @@ -262,9 +248,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } function legalstub$49() { @@ -273,9 +258,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } function legalstub$50() { @@ -284,9 +268,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } function legalstub$59() { @@ -295,9 +278,8 @@ function asmFunc(imports) { $0_1 = wasm2js_scratch_load_i32(1) | 0; $1 = wasm2js_scratch_load_i32(0) | 0; i64toi32_i32$HIGH_BITS = $0_1; - $0_1 = $1; setTempRet0(i64toi32_i32$HIGH_BITS | 0); - return $0_1; + return $1; } return { -- cgit v1.2.3