[PATCH] D35716: AMDGPU: Fix getMemOpBaseRegImmOfs for flat with offsets
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 20 19:16:21 PDT 2017
arsenm created this revision.
Herald added subscribers: t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng.
https://reviews.llvm.org/D35716
Files:
lib/Target/AMDGPU/SIInstrInfo.cpp
Index: lib/Target/AMDGPU/SIInstrInfo.cpp
===================================================================
--- lib/Target/AMDGPU/SIInstrInfo.cpp
+++ lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -305,9 +305,19 @@
}
if (isFLAT(LdSt)) {
- const MachineOperand *AddrReg = getNamedOperand(LdSt, AMDGPU::OpName::vaddr);
- BaseReg = AddrReg->getReg();
- Offset = 0;
+ const MachineOperand *VAddr = getNamedOperand(LdSt, AMDGPU::OpName::vaddr);
+ if (VAddr) {
+ // Can't analyze 2 offsets.
+ if (getNamedOperand(LdSt, AMDGPU::OpName::saddr))
+ return false;
+
+ BaseReg = VAddr->getReg();
+ } else {
+ // scratch instructions have either vaddr or saddr.
+ BaseReg = getNamedOperand(LdSt, AMDGPU::OpName::saddr)->getReg();
+ }
+
+ Offset = getNamedOperand(LdSt, AMDGPU::OpName::offset)->getImm();
return true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35716.107624.patch
Type: text/x-patch
Size: 871 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170721/eefc570f/attachment.bin>
More information about the llvm-commits
mailing list