diff options
Diffstat (limited to 'src/ir/properties.h')
-rw-r--r-- | src/ir/properties.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ir/properties.h b/src/ir/properties.h index 8e5297092..d477cb11c 100644 --- a/src/ir/properties.h +++ b/src/ir/properties.h @@ -84,11 +84,12 @@ inline bool isNamedControlFlow(Expression* curr) { // 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. +// Constant expressions are also allowed in global initializers in wasm. Also +// when two constant expressions compare equal at compile time, their values at +// runtime will be equal as well. // 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>()); + return curr->is<Const>() || curr->is<RefNull>() || curr->is<RefFunc>(); } inline bool isConstantExpression(const Expression* curr) { |