summaryrefslogtreecommitdiff
path: root/src/passes
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes')
-rw-r--r--src/passes/MergeBlocks.cpp10
-rw-r--r--src/passes/OptimizeInstructions.cpp10
2 files changed, 10 insertions, 10 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