summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyRegisterInfo.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@google.com>2016-01-30 21:43:08 +0000
committerDerek Schuff <dschuff@google.com>2016-01-30 21:43:08 +0000
commitc97ba939d15c4d6dc371e9ccf7cd88d1e8c32768 (patch)
treee30cf0c1eb14d7eb1eedca87029e0f21393ab611 /llvm/lib/Target/WebAssembly/WebAssemblyRegisterInfo.cpp
parentfbc89d21dd7c878d5238d90eafd597aff46f33e0 (diff)
downloadbcm5719-llvm-c97ba939d15c4d6dc371e9ccf7cd88d1e8c32768.tar.gz
bcm5719-llvm-c97ba939d15c4d6dc371e9ccf7cd88d1e8c32768.zip
[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.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRegisterInfo.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRegisterInfo.cpp
index 3397f598759..607fd6e79c2 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;
OpenPOWER on IntegriCloud