summaryrefslogtreecommitdiff
path: root/src/ir/properties.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ir/properties.h')
-rw-r--r--src/ir/properties.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ir/properties.h b/src/ir/properties.h
index 485a37e22..b60c74d98 100644
--- a/src/ir/properties.h
+++ b/src/ir/properties.h
@@ -80,10 +80,13 @@ inline bool isNamedControlFlow(Expression* curr) {
return false;
}
+// A constant expression is something like a Const: it has a fixed value known
+// at compile time, and passes that propagate constants can try to propagate it.
+// Constant expressions are also allowed in global initializers in wasm.
+// TODO: look into adding more things here like RttCanon.
inline bool isSingleConstantExpression(const Expression* curr) {
return curr->is<Const>() || curr->is<RefNull>() || curr->is<RefFunc>() ||
- (curr->is<I31New>() && curr->cast<I31New>()->value->is<Const>()) ||
- curr->is<RttCanon>() || curr->is<RttSub>();
+ (curr->is<I31New>() && curr->cast<I31New>()->value->is<Const>());
}
inline bool isConstantExpression(const Expression* curr) {