Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
kripken committed Jul 8, 2022
1 parent e4987cb commit adef90c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/passes/GUFA.cpp
Expand Up @@ -89,6 +89,15 @@ struct GUFAOptimizer
if (!canRemoveStructurally(curr)) {
return false;
}

// We check for shallow effects here, since we may be able to remove |curr|
// itself but keep its children around - we don't want effects in the
// children to stop us from improving the code. Note that there are cases
// where the combined curr+children has fewer effects than curr itself,
// such as if curr is a block and the child branches to it, but in such
// cases we cannot remove curr anyhow (those cases are ruled out by
// canRemoveStructurally), so looking at non-shallow effects would never
// help us (and would be slower to run).
return !ShallowEffectAnalyzer(getPassOptions(), *getModule(), curr)
.hasUnremovableSideEffects();
}
Expand Down

0 comments on commit adef90c

Please sign in to comment.