From b5938499432a1251d94e8e7b534f14919fdaf81c Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 31 Jan 2024 14:31:47 -0800 Subject: Revert "Stop propagating/inlining string constants (#6234)" (#6258) This reverts commit 9090ce56fcc67e15005aeedc59c6bc6773220f11. This has the effect of once more propagating string constants from globals to other places (and from non-globals too), which is useful for various optimizations even if it isn't useful in the final output. To fix the final output problem, #6257 added a pass that is run at the end to collect string.const to globals, which allows us to once more propagate strings in the optimizer, now without a downside. --- test/lit/passes/precompute-gc.wast | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/lit/passes/precompute-gc.wast b/test/lit/passes/precompute-gc.wast index 603788f8c..8d4b56ce7 100644 --- a/test/lit/passes/precompute-gc.wast +++ b/test/lit/passes/precompute-gc.wast @@ -1021,10 +1021,10 @@ ;; CHECK-NEXT: (string.const "hello, world") ;; CHECK-NEXT: ) ;; CHECK-NEXT: (call $strings - ;; CHECK-NEXT: (local.get $s) + ;; CHECK-NEXT: (string.const "hello, world") ;; CHECK-NEXT: ) ;; CHECK-NEXT: (call $strings - ;; CHECK-NEXT: (local.get $s) + ;; CHECK-NEXT: (string.const "hello, world") ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $strings (param $param (ref string)) @@ -1032,9 +1032,7 @@ (local.set $s (string.const "hello, world") ) - ;; The constant string could be propagated twice, to both of these calls, but - ;; we do not do so as it might cause more allocations to happen. - ;; TODO if VMs optimize that, handle it + ;; The constant string should be propagated twice, to both of these calls. (call $strings (local.get $s) ) -- cgit v1.2.3