[WebAssembly] Fix memory bug introduced in 52861809994c
authorThomas Lively <tlively@google.com>
Wed, 19 Feb 2020 23:01:47 +0000 (15:01 -0800)
committerThomas Lively <tlively@google.com>
Wed, 19 Feb 2020 23:07:45 +0000 (15:07 -0800)
commit16aabc86e0ab49dd9dc91dc4d0f71b3fbcdba2bf
treeeb6ccc65c956ef29c99e2e46cd321b48099104dd
parent709fd989b644a80527e0f4a22503d54255bc095c
[WebAssembly] Fix memory bug introduced in 52861809994c

Summary:
The instruction at `DefI` can sometimes be destroyed by
`rematerializeCheapDef`, so it should not be used after calling that
function. The fix is to use `Insert` instead when examining additional
multivalue stackifications. `Insert` is the address of the new
defining instruction after all moves and rematerializations have taken
place.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D74875
llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp