summaryrefslogtreecommitdiff
path: root/src/passes/DataFlowOpts.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-05-01 14:48:41 -0700
committerGitHub <noreply@github.com>2019-05-01 14:48:41 -0700
commit2bd3758a22131cfd6925b3fd995657b211095c90 (patch)
tree2a38a48ab68c00ed1b55e885f86014bbdda92ff2 /src/passes/DataFlowOpts.cpp
parent73709b4da08d285c2237c8c23a54ba53274c0c7f (diff)
downloadbinaryen-2bd3758a22131cfd6925b3fd995657b211095c90.tar.gz
binaryen-2bd3758a22131cfd6925b3fd995657b211095c90.tar.bz2
binaryen-2bd3758a22131cfd6925b3fd995657b211095c90.zip
clang-tidy braces changes (#2075)
Applies the changes in #2065, and temprarily disables the hook since it's too slow to run on a change this large. We should re-enable it in a later commit.
Diffstat (limited to 'src/passes/DataFlowOpts.cpp')
-rw-r--r--src/passes/DataFlowOpts.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/passes/DataFlowOpts.cpp b/src/passes/DataFlowOpts.cpp
index 3391359ef..62d2e5f24 100644
--- a/src/passes/DataFlowOpts.cpp
+++ b/src/passes/DataFlowOpts.cpp
@@ -81,11 +81,13 @@ struct DataFlowOpts : public WalkerPass<PostWalker<DataFlowOpts>> {
}
void workOn(DataFlow::Node* node) {
- if (node->isConst())
+ if (node->isConst()) {
return;
+ }
// If there are no uses, there is no point to work.
- if (nodeUsers.getNumUses(node) == 0)
+ if (nodeUsers.getNumUses(node) == 0) {
return;
+ }
// Optimize: Look for nodes that we can easily convert into
// something simpler.
// TODO: we can expressionify and run full normal opts on that,
@@ -144,8 +146,9 @@ struct DataFlowOpts : public WalkerPass<PostWalker<DataFlowOpts>> {
// Get the optimized thing
auto* result = func->body;
// It may not be a constant, e.g. 0 / 0 does not optimize to 0
- if (!result->is<Const>())
+ if (!result->is<Const>()) {
return;
+ }
// All good, copy it.
node->expr = Builder(*getModule()).makeConst(result->cast<Const>()->value);
assert(node->isConst());