[llvm] 16aabc8 - [WebAssembly] Fix memory bug introduced in 52861809994c
Thomas Lively via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 19 15:07:51 PST 2020
Author: Thomas Lively
Date: 2020-02-19T15:07:45-08:00
New Revision: 16aabc86e0ab49dd9dc91dc4d0f71b3fbcdba2bf
URL: https://github.com/llvm/llvm-project/commit/16aabc86e0ab49dd9dc91dc4d0f71b3fbcdba2bf
DIFF: https://github.com/llvm/llvm-project/commit/16aabc86e0ab49dd9dc91dc4d0f71b3fbcdba2bf.diff
LOG: [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
Added:
Modified:
llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
index ad4a95ccfc4a..82f752f63680 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
@@ -923,9 +923,9 @@ bool WebAssemblyRegStackify::runOnMachineFunction(MachineFunction &MF) {
// 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;
More information about the llvm-commits
mailing list