summaryrefslogtreecommitdiff
path: root/src/passes/Precompute.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/Precompute.cpp')
-rw-r--r--src/passes/Precompute.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/passes/Precompute.cpp b/src/passes/Precompute.cpp
index 57a3ab27f..85eb026f9 100644
--- a/src/passes/Precompute.cpp
+++ b/src/passes/Precompute.cpp
@@ -177,7 +177,7 @@ 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 (Properties::isConstantExpression(curr) || curr->is<Nop>()) {
return;
}
// Until engines implement v128.const and we have SIMD-aware optimizations
@@ -208,14 +208,16 @@ struct Precompute
return;
}
}
- ret->value = Builder(*getModule()).makeConst(flow.value);
+ ret->value = Builder(*getModule()).makeConstExpression(flow.value);
} else {
ret->value = nullptr;
}
} else {
Builder builder(*getModule());
- replaceCurrent(builder.makeReturn(
- flow.value.type != none ? builder.makeConst(flow.value) : nullptr));
+ replaceCurrent(
+ builder.makeReturn(flow.value.type != Type::none
+ ? builder.makeConstExpression(flow.value)
+ : nullptr));
}
return;
}
@@ -234,7 +236,7 @@ struct Precompute
return;
}
}
- br->value = Builder(*getModule()).makeConst(flow.value);
+ br->value = Builder(*getModule()).makeConstExpression(flow.value);
} else {
br->value = nullptr;
}
@@ -243,13 +245,14 @@ struct Precompute
Builder builder(*getModule());
replaceCurrent(builder.makeBreak(
flow.breakTo,
- flow.value.type != none ? builder.makeConst(flow.value) : nullptr));
+ flow.value.type != none ? builder.makeConstExpression(flow.value)
+ : nullptr));
}
return;
}
// this was precomputed
if (flow.value.type.isConcrete()) {
- replaceCurrent(Builder(*getModule()).makeConst(flow.value));
+ replaceCurrent(Builder(*getModule()).makeConstExpression(flow.value));
worked = true;
} else {
ExpressionManipulator::nop(curr);
@@ -350,7 +353,7 @@ private:
} else {
curr = setValues[set];
}
- if (curr.isNull()) {
+ if (curr.isNone()) {
// not a constant, give up
value = Literal();
break;