Skip to content

Commit bfdbc0c

Browse files
committed
review comments
1 parent 4aa3463 commit bfdbc0c

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/passes/MergeBlocks.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ namespace wasm {
7373
// For example, if there is a switch targeting us, we can't do it - we can't remove the value from other targets
7474
struct ProblemFinder : public ControlFlowWalker<ProblemFinder> {
7575
Name origin;
76-
bool noWay = false;
76+
bool foundProblem = false;
7777
// count br_ifs, and dropped br_ifs. if they don't match, then a br_if flow value is used, and we can't drop it
7878
Index brIfs = 0;
7979
Index droppedBrIfs = 0;
@@ -88,7 +88,7 @@ struct ProblemFinder : public ControlFlowWalker<ProblemFinder> {
8888
}
8989
// if the value has side effects, we can't remove it
9090
if (EffectAnalyzer(passOptions, curr->value).hasSideEffects()) {
91-
noWay = true;
91+
foundProblem = true;
9292
}
9393
}
9494
}
@@ -103,20 +103,20 @@ struct ProblemFinder : public ControlFlowWalker<ProblemFinder> {
103103

104104
void visitSwitch(Switch* curr) {
105105
if (curr->default_ == origin) {
106-
noWay = true;
106+
foundProblem = true;
107107
return;
108108
}
109109
for (auto& target : curr->targets) {
110110
if (target == origin) {
111-
noWay = true;
111+
foundProblem = true;
112112
return;
113113
}
114114
}
115115
}
116116

117117
bool found() {
118118
assert(brIfs >= droppedBrIfs);
119-
return noWay || brIfs > droppedBrIfs;
119+
return foundProblem || brIfs > droppedBrIfs;
120120
}
121121
};
122122

src/passes/OptimizeInstructions.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -884,15 +884,15 @@ struct OptimizeInstructions : public WalkerPass<PostWalker<OptimizeInstructions,
884884
if (!Properties::emitsBoolean(left) || !Properties::emitsBoolean(right)) return nullptr;
885885
auto leftEffects = EffectAnalyzer(getPassOptions(), left);
886886
auto rightEffects = EffectAnalyzer(getPassOptions(), right);
887-
auto leftSideEffects = leftEffects.hasSideEffects();
888-
auto rightSideEffects = rightEffects.hasSideEffects();
889-
if (leftSideEffects && rightSideEffects) return nullptr; // both must execute
887+
auto leftHasSideEffects = leftEffects.hasSideEffects();
888+
auto rightHasSideEffects = rightEffects.hasSideEffects();
889+
if (leftHasSideEffects && rightHasSideEffects) return nullptr; // both must execute
890890
// canonicalize with side effects, if any, happening on the left
891-
if (rightSideEffects) {
891+
if (rightHasSideEffects) {
892892
if (CostAnalyzer(left).cost < MIN_COST) return nullptr; // avoidable code is too cheap
893893
if (leftEffects.invalidates(rightEffects)) return nullptr; // cannot reorder
894894
std::swap(left, right);
895-
} else if (leftSideEffects) {
895+
} else if (leftHasSideEffects) {
896896
if (CostAnalyzer(right).cost < MIN_COST) return nullptr; // avoidable code is too cheap
897897
} else {
898898
// no side effects, reorder based on cost estimation

src/wasm/wasm-binary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,7 @@ void WasmBinaryBuilder::visitBlock(Block *curr) {
20732073
auto* item = expressionStack[i];
20742074
curr->list.push_back(item);
20752075
if (i < end - 1) {
2076-
// stacky&unreachable code may introduce elements that need to be dropped in non-final positoins
2076+
// stacky&unreachable code may introduce elements that need to be dropped in non-final positions
20772077
if (isConcreteWasmType(item->type)) {
20782078
curr->list.back() = Builder(wasm).makeDrop(curr->list.back());
20792079
}

0 commit comments

Comments
 (0)