Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/passes/LocalCSE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,9 @@ struct Checker
// Given the current expression, see what it invalidates of the currently-
// hashed expressions, if there are any.
if (!activeOriginals.empty()) {
EffectAnalyzer effects(options, *getModule());
// We only need to visit this node itself, as we have already visited its
// children by the time we get here.
ShallowEffectAnalyzer effects(options, *getModule(), curr);
// We can ignore traps here:
//
// (ORIGINAL)
Expand All @@ -451,10 +453,15 @@ struct Checker
// We are some code in between an original and a copy of it, and we are
// trying to turn COPY into a local.get of a value that we stash at the
// original. If |curr| traps then we simply don't reach the copy anyhow.
//
// Note, however, that this is really for future use, as atm this does not
// help: the only effect a trap can interact with is a set of global state
// (the trap could prevent that writing, which would be noticeable) - but
// LocalCSE does not deduplicate expressions with such effects, as they
// must happen twice. That is, removing trapping from (curr) in the
// example above has no effect as (ORIGINAL) never has global write
// effects.
effects.trap = false;
// We only need to visit this node itself, as we have already visited its
// children by the time we get here.
effects.visit(curr);

std::vector<Expression*> invalidated;
for (auto& kv : activeOriginals) {
Expand Down
Loading