[PATCH] D74875: [WebAssembly] Fix memory bug introduced in 52861809994c
Thomas Lively via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 19 15:06:11 PST 2020
tlively created this revision.
tlively added a reviewer: aheejin.
Herald added subscribers: llvm-commits, sunfish, hiraditya, jgravelle-google, sbc100, dschuff.
Herald added a project: LLVM.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D74875
Files:
llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
Index: llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
===================================================================
--- llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
+++ llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
@@ -923,9 +923,9 @@
// Stackifying a multivalue def may unlock in-place stackification of
// subsequent defs. TODO: Handle the case where the consecutive uses are
// not all in the same instruction.
- auto *SubsequentDef = DefI->defs().begin();
+ auto *SubsequentDef = Insert->defs().begin();
auto *SubsequentUse = &Use;
- while (SubsequentDef != DefI->defs().end() &&
+ while (SubsequentDef != Insert->defs().end() &&
SubsequentUse != Use.getParent()->uses().end()) {
if (!SubsequentDef->isReg() || !SubsequentUse->isReg())
break;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74875.245538.patch
Type: text/x-patch
Size: 884 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200219/983de367/attachment.bin>
More information about the llvm-commits
mailing list