diff options
author | Alon Zakai <azakai@google.com> | 2021-09-15 17:47:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-16 00:47:58 +0000 |
commit | e5b5f83aa6b1859a214a0eae0ee92efab8ce329a (patch) | |
tree | 041c642c62baf22a8ee6bb309964ef4b766a25ad /src/passes/OptimizeInstructions.cpp | |
parent | 1ec93d2ed521431ffea3152759a5b693e085d7a1 (diff) | |
download | binaryen-e5b5f83aa6b1859a214a0eae0ee92efab8ce329a.tar.gz binaryen-e5b5f83aa6b1859a214a0eae0ee92efab8ce329a.tar.bz2 binaryen-e5b5f83aa6b1859a214a0eae0ee92efab8ce329a.zip |
Fix regression from #4130 (#4158)
That PR reused the same node twice in the output, which fails on the
assertion in BINARYEN_PASS_DEBUG=1 mode.
No new test is needed because the existing test suite fails already
in that mode. That the PR managed to land seems to say that we are
not testing pass-debug mode on our lit tests, which we need to
investigate.
Diffstat (limited to 'src/passes/OptimizeInstructions.cpp')
-rw-r--r-- | src/passes/OptimizeInstructions.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index e48eecb72..c9e4d7ff5 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -2934,6 +2934,10 @@ private: } Expression* optimizeMemoryFill(MemoryFill* memFill) { + if (memFill->type == Type::unreachable) { + return nullptr; + } + if (!memFill->size->is<Const>()) { return nullptr; } @@ -3015,19 +3019,21 @@ private: Type::v128); } else { // { i64.store(d, C', 0), i64.store(d, C', 8) } + auto destType = memFill->dest->type; + Index tempLocal = builder.addVar(getFunction(), destType); return builder.makeBlock({ builder.makeStore( 8, offset, align, - memFill->dest, + builder.makeLocalTee(tempLocal, memFill->dest, destType), builder.makeConst<uint64_t>(value * 0x0101010101010101ULL), Type::i64), builder.makeStore( 8, offset + 8, align, - memFill->dest, + builder.makeLocalGet(tempLocal, destType), builder.makeConst<uint64_t>(value * 0x0101010101010101ULL), Type::i64), }); |