summaryrefslogtreecommitdiff
path: root/src/passes
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes')
-rw-r--r--src/passes/OptimizeAddedConstants.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/passes/OptimizeAddedConstants.cpp b/src/passes/OptimizeAddedConstants.cpp
index c76711d8a..f03109223 100644
--- a/src/passes/OptimizeAddedConstants.cpp
+++ b/src/passes/OptimizeAddedConstants.cpp
@@ -290,6 +290,11 @@ struct OptimizeAddedConstants
<< "--low-memory-unused flag is set.";
}
+ if (getModule()->memories.empty()) {
+ // There can be no loads and stores without a memory.
+ return;
+ }
+
// Multiple passes may be needed if we have x + 4 + 8 etc. (nested structs
// in C can cause this, but it's rare). Note that we only need that for the
// propagation case (as 4 + 8 would be optimized directly if it were