diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/GlobalTypeOptimization.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/passes/GlobalTypeOptimization.cpp b/src/passes/GlobalTypeOptimization.cpp index 7e1ebf04e..53c76ca6f 100644 --- a/src/passes/GlobalTypeOptimization.cpp +++ b/src/passes/GlobalTypeOptimization.cpp @@ -391,10 +391,12 @@ struct GlobalTypeOptimization : public Pass { // Map to the new index. curr->index = newIndex; } else { - // This field was removed, so just emit drops of our children. + // This field was removed, so just emit drops of our children (plus a + // trap if the input is null). Builder builder(*getModule()); - replaceCurrent(builder.makeSequence(builder.makeDrop(curr->ref), - builder.makeDrop(curr->value))); + replaceCurrent(builder.makeSequence( + builder.makeDrop(builder.makeRefAs(RefAsNonNull, curr->ref)), + builder.makeDrop(curr->value))); } } |