summaryrefslogtreecommitdiff
path: root/src/passes/stringify-walker-impl.h
diff options
context:
space:
mode:
authorAshley Nelson <nashley@google.com>2023-12-06 22:25:53 -0800
committerGitHub <noreply@github.com>2023-12-06 22:25:53 -0800
commitb8cf38693103127913a12240cbbcabe8ff47c719 (patch)
treef95493abaeddfbd95bcc3e80edde1a367e556174 /src/passes/stringify-walker-impl.h
parent89ad929e11b43c0224d32fd6cffb0eb851586f88 (diff)
downloadbinaryen-b8cf38693103127913a12240cbbcabe8ff47c719.tar.gz
binaryen-b8cf38693103127913a12240cbbcabe8ff47c719.tar.bz2
binaryen-b8cf38693103127913a12240cbbcabe8ff47c719.zip
[Outlining] Fix outlining control flow
Changes the controlFlowQueue used in stringify-walker to push values of Expression*, This ensures that we walk the Wasm module in the same order, regardless of whether the control flow expression is outlined. Reviewers: tlively Reviewed By: tlively Pull Request: https://github.com/WebAssembly/binaryen/pull/6139
Diffstat (limited to 'src/passes/stringify-walker-impl.h')
-rw-r--r--src/passes/stringify-walker-impl.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/passes/stringify-walker-impl.h b/src/passes/stringify-walker-impl.h
index 8ed166d75..cca2a3405 100644
--- a/src/passes/stringify-walker-impl.h
+++ b/src/passes/stringify-walker-impl.h
@@ -43,7 +43,7 @@ template<typename SubType>
inline void StringifyWalker<SubType>::scan(SubType* self, Expression** currp) {
Expression* curr = *currp;
if (Properties::isControlFlowStructure(curr)) {
- self->controlFlowQueue.push(currp);
+ self->controlFlowQueue.push(curr);
self->pushTask(doVisitExpression, currp);
// The if-condition is a value child consumed by the if control flow, which
// makes the if-condition a true sibling rather than part of its contents in
@@ -60,9 +60,8 @@ inline void StringifyWalker<SubType>::scan(SubType* self, Expression** currp) {
// of control flow.
template<typename SubType> void StringifyWalker<SubType>::dequeueControlFlow() {
auto& queue = controlFlowQueue;
- Expression** currp = queue.front();
+ Expression* curr = queue.front();
queue.pop();
- Expression* curr = *currp;
// TODO: Issue #5796, Make a ControlChildIterator
switch (curr->_id) {
@@ -80,7 +79,7 @@ template<typename SubType> void StringifyWalker<SubType>::dequeueControlFlow() {
addUniqueSymbol(SeparatorReason::makeIfStart(iff));
Super::walk(iff->ifTrue);
if (iff->ifFalse) {
- addUniqueSymbol(SeparatorReason::makeElseStart(iff));
+ addUniqueSymbol(SeparatorReason::makeElseStart());
Super::walk(iff->ifFalse);
}
addUniqueSymbol(SeparatorReason::makeEnd());