[PATCH] D100406: [AMDGPU] Factor out SelectSAddrFI()
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 14 11:10:38 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb7ebb25e5353: [AMDGPU] Factor out SelectSAddrFI() (authored by rampitec).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100406/new/
https://reviews.llvm.org/D100406
Files:
llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
Index: llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
@@ -1858,6 +1858,24 @@
return true;
}
+static SDValue SelectSAddrFI(SelectionDAG *CurDAG, SDValue SAddr) {
+ if (auto FI = dyn_cast<FrameIndexSDNode>(SAddr)) {
+ SAddr = CurDAG->getTargetFrameIndex(FI->getIndex(), FI->getValueType(0));
+ } else if (SAddr.getOpcode() == ISD::ADD &&
+ isa<FrameIndexSDNode>(SAddr.getOperand(0))) {
+ // Materialize this into a scalar move for scalar address to avoid
+ // readfirstlane.
+ auto FI = cast<FrameIndexSDNode>(SAddr.getOperand(0));
+ SDValue TFI = CurDAG->getTargetFrameIndex(FI->getIndex(),
+ FI->getValueType(0));
+ SAddr = SDValue(CurDAG->getMachineNode(AMDGPU::S_ADD_U32, SDLoc(SAddr),
+ MVT::i32, TFI, SAddr.getOperand(1)),
+ 0);
+ }
+
+ return SAddr;
+}
+
// Match (32-bit SGPR base) + sext(imm offset)
bool AMDGPUDAGToDAGISel::SelectScratchSAddr(SDNode *N,
SDValue Addr,
@@ -1874,19 +1892,7 @@
SAddr = Addr.getOperand(0);
}
- if (auto FI = dyn_cast<FrameIndexSDNode>(SAddr)) {
- SAddr = CurDAG->getTargetFrameIndex(FI->getIndex(), FI->getValueType(0));
- } else if (SAddr.getOpcode() == ISD::ADD &&
- isa<FrameIndexSDNode>(SAddr.getOperand(0))) {
- // Materialize this into a scalar move for scalar address to avoid
- // readfirstlane.
- auto FI = cast<FrameIndexSDNode>(SAddr.getOperand(0));
- SDValue TFI = CurDAG->getTargetFrameIndex(FI->getIndex(),
- FI->getValueType(0));
- SAddr = SDValue(CurDAG->getMachineNode(AMDGPU::S_ADD_U32, SDLoc(SAddr),
- MVT::i32, TFI, SAddr.getOperand(1)),
- 0);
- }
+ SAddr = SelectSAddrFI(CurDAG, SAddr);
const SIInstrInfo *TII = Subtarget->getInstrInfo();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100406.337492.patch
Type: text/x-patch
Size: 2114 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210414/241f62f2/attachment-0001.bin>
More information about the llvm-commits
mailing list