@@ -671,7 +671,9 @@ class EffectAnalyzer {
671671 }
672672 }
673673
674- // Handle effects due to an explicit null check on the given type.
674+ // Handle effects due to a null type arriving in a place where a null input
675+ // causes trapping. That is, handle the case of the type proving that the
676+ // input is null.
675677 // Returns true iff there is no need to consider further effects.
676678 bool trapOnNull (Type type) {
677679 if (type == Type::unreachable) {
@@ -734,16 +736,6 @@ class EffectAnalyzer {
734736 addCallEffects (curr, bodyEffects);
735737 }
736738 void visitCallIndirect (CallIndirect* curr) {
737- auto * table = parent.module .getTable (curr->table );
738- if (trapOnNull (table->type )) {
739- return ;
740- }
741- if (!Type::isSubType (Type (curr->heapType , Nullability::Nullable),
742- table->type )) {
743- parent.trap = true ;
744- return ;
745- }
746-
747739 const EffectAnalyzer* bodyEffects = nullptr ;
748740 if (auto it = parent.module .typeEffects .find (curr->heapType );
749741 it != parent.module .typeEffects .end ()) {
@@ -1309,7 +1301,7 @@ class EffectAnalyzer {
13091301 // null refs).
13101302 template <typename CallType>
13111303 void addCallEffectsFromGlobalEffects (const CallType* curr,
1312- const EffectAnalyzer& funcEffects) {
1304+ const EffectAnalyzer& funcEffects) {
13131305 if (curr->isReturn ) {
13141306 if (funcEffects.throws ()) {
13151307 parent.hasReturnCallThrow = true ;
@@ -1328,9 +1320,8 @@ class EffectAnalyzer {
13281320 // Common effects logic for the 3 types of call: `call`, `call_indirect`,
13291321 // and `call_ref`.
13301322 template <typename CallType>
1331- void
1332- addCallEffects (const CallType* curr,
1333- const EffectAnalyzer* bodyEffects) {
1323+ void addCallEffects (const CallType* curr,
1324+ const EffectAnalyzer* bodyEffects) {
13341325 if (curr->isReturn ) {
13351326 parent.branchesOut = true ;
13361327 }
0 commit comments