summaryrefslogtreecommitdiff
path: root/src/passes/Precompute.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/Precompute.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/Precompute.cpp')
-rw-r--r--src/passes/Precompute.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/passes/Precompute.cpp b/src/passes/Precompute.cpp
index 074dd832c..02fd089ec 100644
--- a/src/passes/Precompute.cpp
+++ b/src/passes/Precompute.cpp
@@ -163,20 +163,24 @@ struct Precompute
void visitExpression(Expression* curr) {
// TODO: if local.get, only replace with a constant if we don't care about
// size...?
- if (curr->is<Const>() || curr->is<Nop>())
+ if (curr->is<Const>() || curr->is<Nop>()) {
return;
+ }
// Until engines implement v128.const and we have SIMD-aware optimizations
// that can break large v128.const instructions into smaller consts and
// splats, do not try to precompute v128 expressions.
- if (isVectorType(curr->type))
+ if (isVectorType(curr->type)) {
return;
+ }
// try to evaluate this into a const
Flow flow = precomputeExpression(curr);
- if (isVectorType(flow.value.type))
+ if (isVectorType(flow.value.type)) {
return;
+ }
if (flow.breaking()) {
- if (flow.breakTo == NOTPRECOMPUTABLE_FLOW)
+ if (flow.breakTo == NOTPRECOMPUTABLE_FLOW) {
return;
+ }
if (flow.breakTo == RETURN_FLOW) {
// this expression causes a return. if it's already a return, reuse the
// node
@@ -301,8 +305,9 @@ private:
// mark it as such and add everything it influences to the work list,
// as they may be constant too.
if (auto* set = curr->dynCast<SetLocal>()) {
- if (setValues[set].isConcrete())
+ if (setValues[set].isConcrete()) {
continue; // already known constant
+ }
auto value = setValues[set] = precomputeValue(set->value);
if (value.isConcrete()) {
for (auto* get : localGraph.setInfluences[set]) {
@@ -311,8 +316,9 @@ private:
}
} else {
auto* get = curr->cast<GetLocal>();
- if (getValues[get].isConcrete())
+ if (getValues[get].isConcrete()) {
continue; // already known constant
+ }
// for this get to have constant value, all sets must agree
Literal value;
bool first = true;