From a6c1165db639e505d68758b14256492ede57e362 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 12 Dec 2023 14:00:04 -0800 Subject: Add a `tuple.drop` text pseudoinstruction (#6170) We previously overloaded `drop` to mean both normal drops of single values and also drops of tuple values. That works fine in the legacy text parser since it can infer parent-child relationships directly from the s-expression structure of the input, so it knows that a drop should drop an entire tuple if the tuple-producing instruction is a child of the drop. The new text parser, however, is much more like the binary parser in that it uses instruction types to create parent-child instructions. The new parser always assumes that `drop` is meant to drop just a single value because that's what it does in WebAssembly. Since we want to continue to let `Drop` IR expressions consume tuples, and since we will need a way to write tests for that IR pattern that work with the new parser, introduce a new pseudoinstruction, `tuple.drop`, to represent drops of tuples. This pseudoinstruction only exists in the text format and it parses to normal `Drop` expressions. `tuple.drop` takes the arity of its operand as an immediate, which will let the new parser parse it correctly in the future. --- test/lit/passes/vacuum_all-features.wast | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/lit/passes/vacuum_all-features.wast') diff --git a/test/lit/passes/vacuum_all-features.wast b/test/lit/passes/vacuum_all-features.wast index f85d21692..9b06624cf 100644 --- a/test/lit/passes/vacuum_all-features.wast +++ b/test/lit/passes/vacuum_all-features.wast @@ -1286,14 +1286,14 @@ ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $1 - (drop + (tuple.drop 2 (block $block (result funcref i32) ;; we can vaccum out all parts of this block: the br_if is not taken, there ;; is a nop, and the tuple at the end goes to a dropped block anyhow. this ;; test specifically verifies handling of tuples containing non-nullable ;; types, for which we try to create a zero in an intermediate step along ;; the way. - (drop + (tuple.drop 2 (br_if $block (tuple.make 2 (ref.func $1) -- cgit v1.2.3