summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/passes/CoalesceLocals.cpp9
-rw-r--r--src/passes/Inlining.cpp6
-rw-r--r--src/passes/RedundantSetElimination.cpp4
3 files changed, 10 insertions, 9 deletions
diff --git a/src/passes/CoalesceLocals.cpp b/src/passes/CoalesceLocals.cpp
index 42296b5bf..f58e57e72 100644
--- a/src/passes/CoalesceLocals.cpp
+++ b/src/passes/CoalesceLocals.cpp
@@ -209,10 +209,11 @@ void CoalesceLocals::calculateInterferences() {
for (Index i = func->getNumParams(); i < func->getNumLocals(); i++) {
auto type = func->getLocalType(i);
- if (type.isNonNullable()) {
- // A non-nullable value cannot be used anyhow, but we must give it
- // some value. A unique one seems least likely to result in surprise
- // during debugging.
+ if (!LiteralUtils::canMakeZero(type)) {
+ // The default value for a type for which we can't make a zero cannot
+ // be used anyhow, but we must give it some value in this analysis. A
+ // unique one seems least likely to result in surprise during
+ // debugging.
values[i] = valueNumbering.getUniqueValue();
} else {
values[i] = valueNumbering.getValue(Literal::makeZeros(type));
diff --git a/src/passes/Inlining.cpp b/src/passes/Inlining.cpp
index e81649bd2..36610a224 100644
--- a/src/passes/Inlining.cpp
+++ b/src/passes/Inlining.cpp
@@ -343,9 +343,9 @@ doInlining(Module* module, Function* into, const InliningAction& action) {
// zero-init value
for (Index i = 0; i < from->vars.size(); i++) {
auto type = from->vars[i];
- if (type.isNonNullable()) {
- // Non-nullable locals do not need to be zeroed out. They have no zero
- // value, and by definition should not be used before being written to, so
+ if (!LiteralUtils::canMakeZero(type)) {
+ // Non-zeroable locals do not need to be zeroed out. As they have no zero
+ // value they by definition should not be used before being written to, so
// any value we set here would not be observed anyhow.
continue;
}
diff --git a/src/passes/RedundantSetElimination.cpp b/src/passes/RedundantSetElimination.cpp
index 56fca4bee..90925edf2 100644
--- a/src/passes/RedundantSetElimination.cpp
+++ b/src/passes/RedundantSetElimination.cpp
@@ -175,9 +175,9 @@ struct RedundantSetElimination
std::cout << "new param value for " << i << '\n';
#endif
start[i] = getUniqueValue();
- } else if (type.isNonNullable()) {
+ } else if (!LiteralUtils::canMakeZero(type)) {
#ifdef RSE_DEBUG
- std::cout << "new unique value for non-nullable " << i << '\n';
+ std::cout << "new unique value for non-zeroable " << i << '\n';
#endif
start[i] = getUniqueValue();
} else {