diff --git a/src/passes/LegalizeJSInterface.cpp b/src/passes/LegalizeJSInterface.cpp index e3b58f6f8b9..5eb43a36747 100644 --- a/src/passes/LegalizeJSInterface.cpp +++ b/src/passes/LegalizeJSInterface.cpp @@ -412,6 +412,7 @@ struct LegalizeAndPruneJSInterface : public LegalizeJSInterface { // RefFunc types etc. need updating. ReFinalize().run(getPassRunner(), module); + ReFinalize().runOnModuleCode(getPassRunner(), module); // TODO: globals etc. } diff --git a/test/lit/passes/legalize-and-prune-js-interface.wast b/test/lit/passes/legalize-and-prune-js-interface.wast index 01b89d42912..c1221959194 100644 --- a/test/lit/passes/legalize-and-prune-js-interface.wast +++ b/test/lit/passes/legalize-and-prune-js-interface.wast @@ -45,6 +45,14 @@ ;; CHECK: (import "env" "imported-64" (func $legalimport$imported-64 (type $9) (param i32 f64) (result i32))) + ;; CHECK: (global $global funcref (ref.func $imported-v128)) + (global $global funcref + ;; The ref target will turn from an import into an internal function. We'd + ;; error if we do not update this ref.func while doing so, to make its type + ;; exact. + (ref.func $imported-v128) + ) + ;; CHECK: (func $imported-v128 (type $0) (result v128) ;; CHECK-NEXT: (v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000) ;; CHECK-NEXT: )