Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion src/passes/Precompute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class PrecomputingExpressionRunner
if (iter != getValues.end()) {
auto values = iter->second;
if (values.isConcrete()) {
return Flow(std::move(values));
return Flow(values);
}
}
return ExpressionRunner<PrecomputingExpressionRunner>::visitLocalGet(curr);
Expand Down
33 changes: 17 additions & 16 deletions src/wasm-interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ class ExpressionRunner : public OverriddenVisitor<SubType, Flow> {
// Check if a constant value has been set in the context of this runner.
auto iter = localValues.find(curr->index);
if (iter != localValues.end()) {
return Flow(std::move(iter->second));
return Flow(iter->second);
}
return Flow(NONCONSTANT_FLOW);
}
Expand Down Expand Up @@ -1288,7 +1288,7 @@ class ExpressionRunner : public OverriddenVisitor<SubType, Flow> {
// Check if a constant value has been set in the context of this runner.
auto iter = globalValues.find(curr->name);
if (iter != globalValues.end()) {
return Flow(std::move(iter->second));
return Flow(iter->second);
}
return Flow(NONCONSTANT_FLOW);
}
Expand Down Expand Up @@ -1327,13 +1327,13 @@ class ExpressionRunner : public OverriddenVisitor<SubType, Flow> {
auto argFlow = visit(curr->operands[i]);
if (!argFlow.breaking()) {
assert(argFlow.values.isConcrete());
localValues[i] = std::move(argFlow.values);
localValues[i] = argFlow.values;
}
}
auto retFlow = visit(func->body);
localValues = std::move(prevLocalValues);
localValues = prevLocalValues;
if (retFlow.breakTo == RETURN_FLOW) {
return Flow(std::move(retFlow.values));
return Flow(retFlow.values);
} else if (!retFlow.breaking()) {
return retFlow;
}
Expand All @@ -1343,7 +1343,7 @@ class ExpressionRunner : public OverriddenVisitor<SubType, Flow> {
return Flow(NONCONSTANT_FLOW);
}

Flow visitCallIndirect(CallIndirect*) {
Flow visitCallIndirect(CallIndirect* curr) {
NOTE_ENTER("CallIndirect");
return Flow(NONCONSTANT_FLOW);
}
Expand Down Expand Up @@ -1375,39 +1375,39 @@ class ExpressionRunner : public OverriddenVisitor<SubType, Flow> {
NOTE_ENTER("MemoryFill");
return Flow(NONCONSTANT_FLOW);
}
Flow visitAtomicRMW(AtomicRMW*) {
Flow visitAtomicRMW(AtomicRMW* curr) {
NOTE_ENTER("AtomicRMW");
return Flow(NONCONSTANT_FLOW);
}
Flow visitAtomicCmpxchg(AtomicCmpxchg*) {
Flow visitAtomicCmpxchg(AtomicCmpxchg* curr) {
NOTE_ENTER("AtomicCmpxchg");
return Flow(NONCONSTANT_FLOW);
}
Flow visitAtomicWait(AtomicWait*) {
Flow visitAtomicWait(AtomicWait* curr) {
NOTE_ENTER("AtomicWait");
return Flow(NONCONSTANT_FLOW);
}
Flow visitAtomicNotify(AtomicNotify*) {
Flow visitAtomicNotify(AtomicNotify* curr) {
NOTE_ENTER("AtomicNotify");
return Flow(NONCONSTANT_FLOW);
}
Flow visitSIMDLoad(SIMDLoad*) {
Flow visitSIMDLoad(SIMDLoad* curr) {
NOTE_ENTER("SIMDLoad");
return Flow(NONCONSTANT_FLOW);
}
Flow visitSIMDLoadSplat(SIMDLoad*) {
Flow visitSIMDLoadSplat(SIMDLoad* curr) {
NOTE_ENTER("SIMDLoadSplat");
return Flow(NONCONSTANT_FLOW);
}
Flow visitSIMDLoadExtend(SIMDLoad*) {
Flow visitSIMDLoadExtend(SIMDLoad* curr) {
NOTE_ENTER("SIMDLoadExtend");
return Flow(NONCONSTANT_FLOW);
}
Flow visitPush(Push*) {
Flow visitPush(Push* curr) {
NOTE_ENTER("Push");
return Flow(NONCONSTANT_FLOW);
}
Flow visitPop(Pop*) {
Flow visitPop(Pop* curr) {
NOTE_ENTER("Pop");
return Flow(NONCONSTANT_FLOW);
}
Expand Down Expand Up @@ -2470,7 +2470,8 @@ template<typename GlobalManager, typename SubType> class ModuleInstanceBase {
functionStack.pop_back();
}
#ifdef WASM_INTERPRETER_DEBUG
std::cout << "exiting " << function->name << " with " << ret << '\n';
std::cout << "exiting " << function->name << " with " << flow.values
<< '\n';
#endif
return flow.values;
}
Expand Down
4 changes: 4 additions & 0 deletions src/wasm-printing.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ inline std::ostream& operator<<(std::ostream& o, wasm::Expression& expression) {
return wasm::WasmPrinter::printExpression(&expression, o);
}

inline std::ostream& operator<<(std::ostream& o, wasm::Expression* expression) {
return wasm::WasmPrinter::printExpression(expression, o);
}

inline std::ostream& operator<<(std::ostream& o, wasm::StackInst& inst) {
return wasm::WasmPrinter::printStackInst(&inst, o);
}
Expand Down
1 change: 1 addition & 0 deletions test/passes/issue2788.passes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
all-features_precompute-propagate
Loading