[PATCH] D124086: [AMDGPU] Remove no-ret atomic ops selection in the post-isel hook
Abinav Puthan Purayil via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 20 04:01:48 PDT 2022
abinavpp created this revision.
abinavpp added reviewers: arsenm, foad, Petar.Avramovic, rampitec.
Herald added subscribers: hsmhsm, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
Herald added a project: All.
abinavpp requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
No-ret atomic ops are now selected in tblgen.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D124086
Files:
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
Index: llvm/lib/Target/AMDGPU/SIISelLowering.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -11706,47 +11706,6 @@
return;
}
- // Replace unused atomics with the no return version.
- int NoRetAtomicOp = AMDGPU::getAtomicNoRetOp(MI.getOpcode());
- if (NoRetAtomicOp != -1) {
- if (!Node->hasAnyUseOfValue(0)) {
- int CPolIdx = AMDGPU::getNamedOperandIdx(MI.getOpcode(),
- AMDGPU::OpName::cpol);
- if (CPolIdx != -1) {
- MachineOperand &CPol = MI.getOperand(CPolIdx);
- CPol.setImm(CPol.getImm() & ~AMDGPU::CPol::GLC);
- }
- MI.removeOperand(0);
- MI.setDesc(TII->get(NoRetAtomicOp));
- return;
- }
-
- // For mubuf_atomic_cmpswap, we need to have tablegen use an extract_subreg
- // instruction, because the return type of these instructions is a vec2 of
- // the memory type, so it can be tied to the input operand.
- // This means these instructions always have a use, so we need to add a
- // special case to check if the atomic has only one extract_subreg use,
- // which itself has no uses.
- if ((Node->hasNUsesOfValue(1, 0) &&
- Node->use_begin()->isMachineOpcode() &&
- Node->use_begin()->getMachineOpcode() == AMDGPU::EXTRACT_SUBREG &&
- !Node->use_begin()->hasAnyUseOfValue(0))) {
- Register Def = MI.getOperand(0).getReg();
-
- // Change this into a noret atomic.
- MI.setDesc(TII->get(NoRetAtomicOp));
- MI.removeOperand(0);
-
- // If we only remove the def operand from the atomic instruction, the
- // extract_subreg will be left with a use of a vreg without a def.
- // So we need to insert an implicit_def to avoid machine verifier
- // errors.
- BuildMI(*MI.getParent(), MI, MI.getDebugLoc(),
- TII->get(AMDGPU::IMPLICIT_DEF), Def);
- }
- return;
- }
-
if (TII->isMIMG(MI) && !MI.mayStore())
AddIMGInit(MI);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124086.423866.patch
Type: text/x-patch
Size: 2073 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220420/691b0749/attachment.bin>
More information about the llvm-commits
mailing list