diff options
author | Derek Schuff <dschuff@google.com> | 2016-01-30 21:43:08 +0000 |
---|---|---|
committer | Derek Schuff <dschuff@google.com> | 2016-01-30 21:43:08 +0000 |
commit | c97ba939d15c4d6dc371e9ccf7cd88d1e8c32768 (patch) | |
tree | e30cf0c1eb14d7eb1eedca87029e0f21393ab611 /llvm/lib/Target/WebAssembly/WebAssemblyRegisterInfo.cpp | |
parent | fbc89d21dd7c878d5238d90eafd597aff46f33e0 (diff) | |
download | llvm-c97ba939d15c4d6dc371e9ccf7cd88d1e8c32768.zip llvm-c97ba939d15c4d6dc371e9ccf7cd88d1e8c32768.tar.gz llvm-c97ba939d15c4d6dc371e9ccf7cd88d1e8c32768.tar.bz2 |
[WebAssembly] Fix uses of FrameIndex as store values
Previously the code assumed all uses of FI on loads and stores were as
addresses. This checks whether the use is the address or a value and
handles the latter case as it does for non-memory instructions.
llvm-svn: 259306
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyRegisterInfo.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyRegisterInfo.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRegisterInfo.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRegisterInfo.cpp index 3397f59..607fd6e 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyRegisterInfo.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyRegisterInfo.cpp @@ -63,9 +63,9 @@ void WebAssemblyRegisterInfo::eliminateFrameIndex( const MachineFrameInfo &MFI = *MF.getFrameInfo(); int64_t FrameOffset = MFI.getStackSize() + MFI.getObjectOffset(FrameIndex); - if (MI.mayLoadOrStore()) { - // If this is a load or store, make it relative to SP and fold the frame - // offset directly in. + if (MI.mayLoadOrStore() && FIOperandNum == WebAssembly::MemOpAddressOperandNo) { + // If this is the address operand of a load or store, make it relative to SP + // and fold the frame offset directly in. assert(FrameOffset >= 0 && MI.getOperand(1).getImm() >= 0); int64_t Offset = MI.getOperand(1).getImm() + FrameOffset; |