From bcc76146fed433cbc8ba01a9f568d979c145110b Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Mon, 30 Dec 2019 17:55:20 -0800 Subject: Add support for reference types proposal (#2451) This adds support for the reference type proposal. This includes support for all reference types (`anyref`, `funcref`(=`anyfunc`), and `nullref`) and four new instructions: `ref.null`, `ref.is_null`, `ref.func`, and new typed `select`. This also adds subtype relationship support between reference types. This does not include table instructions yet. This also does not include wasm2js support. Fixes #2444 and fixes #2447. --- src/passes/OptimizeInstructions.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/passes/OptimizeInstructions.cpp') diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index 6de1d3d00..edd6ba2b6 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -751,12 +751,12 @@ struct OptimizeInstructions // condition, do that auto needCondition = EffectAnalyzer(getPassOptions(), iff->condition).hasSideEffects(); - auto typeIsIdentical = iff->ifTrue->type == iff->type; - if (typeIsIdentical && !needCondition) { + auto isSubType = Type::isSubType(iff->ifTrue->type, iff->type); + if (isSubType && !needCondition) { return iff->ifTrue; } else { Builder builder(*getModule()); - if (typeIsIdentical) { + if (isSubType) { return builder.makeSequence(builder.makeDrop(iff->condition), iff->ifTrue); } else { -- cgit v1.2.3