diff --git a/src/passes/OptimizeAddedConstants.cpp b/src/passes/OptimizeAddedConstants.cpp index 696aeaa1c08..934fe8be8ad 100644 --- a/src/passes/OptimizeAddedConstants.cpp +++ b/src/passes/OptimizeAddedConstants.cpp @@ -285,8 +285,11 @@ struct OptimizeAddedConstants } void doWalkFunction(Function* func) { - // This pass is only valid under the assumption of unused low memory. - assert(getPassOptions().lowMemoryUnused); + if (!getPassOptions().lowMemoryUnused) { + Fatal() << "OptimizeAddedConstants can only be run when the " + << "--low-memory-unused flag is set."; + } + // 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