diff options
author | Alon Zakai (kripken) <alonzakai@gmail.com> | 2017-07-31 13:39:46 -0700 |
---|---|---|
committer | Alon Zakai (kripken) <alonzakai@gmail.com> | 2017-07-31 13:39:46 -0700 |
commit | bfdbc0c3f6a835231b218a60ddd6b52f7e9affed (patch) | |
tree | 33c7f9e53bf6c52b1eca1b9b6f234a6d184aaf56 | |
parent | 4aa3463a6b98e41070d03ddbe60e689537b02b59 (diff) | |
download | binaryen-bfdbc0c3f6a835231b218a60ddd6b52f7e9affed.tar.gz binaryen-bfdbc0c3f6a835231b218a60ddd6b52f7e9affed.tar.bz2 binaryen-bfdbc0c3f6a835231b218a60ddd6b52f7e9affed.zip |
review comments
-rw-r--r-- | src/passes/MergeBlocks.cpp | 10 | ||||
-rw-r--r-- | src/passes/OptimizeInstructions.cpp | 10 | ||||
-rw-r--r-- | src/wasm/wasm-binary.cpp | 2 |
3 files changed, 11 insertions, 11 deletions
diff --git a/src/passes/MergeBlocks.cpp b/src/passes/MergeBlocks.cpp index 05aa468e1..7c086a920 100644 --- a/src/passes/MergeBlocks.cpp +++ b/src/passes/MergeBlocks.cpp @@ -73,7 +73,7 @@ namespace wasm { // For example, if there is a switch targeting us, we can't do it - we can't remove the value from other targets struct ProblemFinder : public ControlFlowWalker<ProblemFinder> { Name origin; - bool noWay = false; + bool foundProblem = false; // 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 Index brIfs = 0; Index droppedBrIfs = 0; @@ -88,7 +88,7 @@ struct ProblemFinder : public ControlFlowWalker<ProblemFinder> { } // if the value has side effects, we can't remove it if (EffectAnalyzer(passOptions, curr->value).hasSideEffects()) { - noWay = true; + foundProblem = true; } } } @@ -103,12 +103,12 @@ struct ProblemFinder : public ControlFlowWalker<ProblemFinder> { void visitSwitch(Switch* curr) { if (curr->default_ == origin) { - noWay = true; + foundProblem = true; return; } for (auto& target : curr->targets) { if (target == origin) { - noWay = true; + foundProblem = true; return; } } @@ -116,7 +116,7 @@ struct ProblemFinder : public ControlFlowWalker<ProblemFinder> { bool found() { assert(brIfs >= droppedBrIfs); - return noWay || brIfs > droppedBrIfs; + return foundProblem || brIfs > droppedBrIfs; } }; diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index 6179833b8..4fd7cbe8d 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -884,15 +884,15 @@ private: if (!Properties::emitsBoolean(left) || !Properties::emitsBoolean(right)) return nullptr; auto leftEffects = EffectAnalyzer(getPassOptions(), left); auto rightEffects = EffectAnalyzer(getPassOptions(), right); - auto leftSideEffects = leftEffects.hasSideEffects(); - auto rightSideEffects = rightEffects.hasSideEffects(); - if (leftSideEffects && rightSideEffects) return nullptr; // both must execute + auto leftHasSideEffects = leftEffects.hasSideEffects(); + auto rightHasSideEffects = rightEffects.hasSideEffects(); + if (leftHasSideEffects && rightHasSideEffects) return nullptr; // both must execute // canonicalize with side effects, if any, happening on the left - if (rightSideEffects) { + if (rightHasSideEffects) { if (CostAnalyzer(left).cost < MIN_COST) return nullptr; // avoidable code is too cheap if (leftEffects.invalidates(rightEffects)) return nullptr; // cannot reorder std::swap(left, right); - } else if (leftSideEffects) { + } else if (leftHasSideEffects) { if (CostAnalyzer(right).cost < MIN_COST) return nullptr; // avoidable code is too cheap } else { // no side effects, reorder based on cost estimation diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index ac8df5711..1bc5ada94 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -2073,7 +2073,7 @@ void WasmBinaryBuilder::visitBlock(Block *curr) { auto* item = expressionStack[i]; curr->list.push_back(item); if (i < end - 1) { - // stacky&unreachable code may introduce elements that need to be dropped in non-final positoins + // stacky&unreachable code may introduce elements that need to be dropped in non-final positions if (isConcreteWasmType(item->type)) { curr->list.back() = Builder(wasm).makeDrop(curr->list.back()); } |