@@ -725,35 +725,23 @@ class EffectAnalyzer {
725725 return ;
726726 }
727727
728- // Get the target's effects, if they exist. Note that we must handle the
729- // case of the function not yet existing (we may be executed in the middle
730- // of a pass, which may have built up calls but not the targets of those
731- // calls; in such a case, we do not find the targets and therefore assume
732- // we know nothing about the effects, which is safe).
733- const EffectAnalyzer* targetEffects = nullptr ;
734- if (auto * target = parent.module .getFunctionOrNull (curr->target )) {
735- targetEffects = target->effects .get ();
736- }
737- if (targetEffects) {
738- populateEffectsFromGlobalEffects (*targetEffects, curr);
728+ if (auto * target = parent.module .getFunctionOrNull (curr->target );
729+ target->effects ) {
730+ populateEffectsFromGlobalEffects (*target->effects , curr);
739731 return ;
740732 }
733+ parent.calls = true ;
741734
742- if (curr-> isReturn ) {
743- parent. branchesOut = true ;
744- // When EH is enabled, any call can throw.
745- if (parent. features . hasExceptionHandling () ) {
735+ // If EH is enabled and we don't have global effects information,
736+ // assume that the call body may throw.
737+ if (parent. features . hasExceptionHandling ()) {
738+ if (curr-> isReturn ) {
746739 parent.hasReturnCallThrow = true ;
747740 }
748- }
749741
750- parent.calls = true ;
751- // When EH is enabled, any call can throw. Skip this for return calls
752- // because the throw is already more precisely captured by the combination
753- // of `hasReturnCallThrow` and `branchesOut`.
754- if (parent.features .hasExceptionHandling () && parent.tryDepth == 0 &&
755- !curr->isReturn ) {
756- parent.throws_ = true ;
742+ if (parent.tryDepth == 0 && !curr->isReturn ) {
743+ parent.throws_ = true ;
744+ }
757745 }
758746 }
759747 void visitCallIndirect (CallIndirect* curr) {
0 commit comments