Skip to content

Commit 2147b6c

Browse files
committed
[AMDGPU] Remove no-ret atomic ops selection in the post-isel hook
No-ret atomic ops are now selected in tblgen. Differential Revision: https://reviews.llvm.org/D124086
1 parent 165ae72 commit 2147b6c

File tree

1 file changed

+0
-41
lines changed

1 file changed

+0
-41
lines changed

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11698,47 +11698,6 @@ void SITargetLowering::AdjustInstrPostInstrSelection(MachineInstr &MI,
1169811698
return;
1169911699
}
1170011700

11701-
// Replace unused atomics with the no return version.
11702-
int NoRetAtomicOp = AMDGPU::getAtomicNoRetOp(MI.getOpcode());
11703-
if (NoRetAtomicOp != -1) {
11704-
if (!Node->hasAnyUseOfValue(0)) {
11705-
int CPolIdx = AMDGPU::getNamedOperandIdx(MI.getOpcode(),
11706-
AMDGPU::OpName::cpol);
11707-
if (CPolIdx != -1) {
11708-
MachineOperand &CPol = MI.getOperand(CPolIdx);
11709-
CPol.setImm(CPol.getImm() & ~AMDGPU::CPol::GLC);
11710-
}
11711-
MI.removeOperand(0);
11712-
MI.setDesc(TII->get(NoRetAtomicOp));
11713-
return;
11714-
}
11715-
11716-
// For mubuf_atomic_cmpswap, we need to have tablegen use an extract_subreg
11717-
// instruction, because the return type of these instructions is a vec2 of
11718-
// the memory type, so it can be tied to the input operand.
11719-
// This means these instructions always have a use, so we need to add a
11720-
// special case to check if the atomic has only one extract_subreg use,
11721-
// which itself has no uses.
11722-
if ((Node->hasNUsesOfValue(1, 0) &&
11723-
Node->use_begin()->isMachineOpcode() &&
11724-
Node->use_begin()->getMachineOpcode() == AMDGPU::EXTRACT_SUBREG &&
11725-
!Node->use_begin()->hasAnyUseOfValue(0))) {
11726-
Register Def = MI.getOperand(0).getReg();
11727-
11728-
// Change this into a noret atomic.
11729-
MI.setDesc(TII->get(NoRetAtomicOp));
11730-
MI.removeOperand(0);
11731-
11732-
// If we only remove the def operand from the atomic instruction, the
11733-
// extract_subreg will be left with a use of a vreg without a def.
11734-
// So we need to insert an implicit_def to avoid machine verifier
11735-
// errors.
11736-
BuildMI(*MI.getParent(), MI, MI.getDebugLoc(),
11737-
TII->get(AMDGPU::IMPLICIT_DEF), Def);
11738-
}
11739-
return;
11740-
}
11741-
1174211701
if (TII->isMIMG(MI) && !MI.mayStore())
1174311702
AddIMGInit(MI);
1174411703
}

0 commit comments

Comments
 (0)