-
Notifications
You must be signed in to change notification settings - Fork 14k
[AMDGPU] si-peephole-sdwa: Remove dead code from createSDWAversion #141462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AMDGPU] si-peephole-sdwa: Remove dead code from createSDWAversion #141462
Conversation
In an earlier state of this code, it was possible for an existing SDWA MI to reach the code in the "createSDWAversion" function. This is no longer possible; see assert at the top of the function. Remove code that tries to handle operands on pre-existing SDWA instructions from the function.
@llvm/pr-subscribers-backend-amdgpu Author: Frederik Harwath (frederik-h) ChangesIn an earlier state of this code, it was possible for an existing SDWA MI to reach the code in the "createSDWAversion" function. This is no longer possible; see assert at the top of the function. Remove code that tries to handle operands on pre-existing SDWA instructions from the function. Full diff: https://github.com/llvm/llvm-project/pull/141462.diff 1 Files Affected:
diff --git a/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp b/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
index 1e305c2efc8a0..eb18677780803 100644
--- a/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
+++ b/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
@@ -1273,65 +1273,22 @@ MachineInstr *SIPeepholeSDWA::createSDWAVersion(MachineInstr &MI) {
}
}
- // Copy dst_sel if present, initialize otherwise if needed
- if (AMDGPU::hasNamedOperand(SDWAOpcode, AMDGPU::OpName::dst_sel)) {
- MachineOperand *DstSel = TII->getNamedOperand(MI, AMDGPU::OpName::dst_sel);
- if (DstSel) {
- SDWAInst.add(*DstSel);
- } else {
- SDWAInst.addImm(AMDGPU::SDWA::SdwaSel::DWORD);
- }
- }
+ // Initialize SDWA specific operands
+ if (AMDGPU::hasNamedOperand(SDWAOpcode, AMDGPU::OpName::dst_sel))
+ SDWAInst.addImm(AMDGPU::SDWA::SdwaSel::DWORD);
- // Copy dst_unused if present, initialize otherwise if needed
- if (AMDGPU::hasNamedOperand(SDWAOpcode, AMDGPU::OpName::dst_unused)) {
- MachineOperand *DstUnused = TII->getNamedOperand(MI, AMDGPU::OpName::dst_unused);
- if (DstUnused) {
- SDWAInst.add(*DstUnused);
- } else {
- SDWAInst.addImm(AMDGPU::SDWA::DstUnused::UNUSED_PAD);
- }
- }
+ if (AMDGPU::hasNamedOperand(SDWAOpcode, AMDGPU::OpName::dst_unused))
+ SDWAInst.addImm(AMDGPU::SDWA::DstUnused::UNUSED_PAD);
- // Copy src0_sel if present, initialize otherwise
assert(AMDGPU::hasNamedOperand(SDWAOpcode, AMDGPU::OpName::src0_sel));
- MachineOperand *Src0Sel = TII->getNamedOperand(MI, AMDGPU::OpName::src0_sel);
- if (Src0Sel) {
- SDWAInst.add(*Src0Sel);
- } else {
- SDWAInst.addImm(AMDGPU::SDWA::SdwaSel::DWORD);
- }
+ SDWAInst.addImm(AMDGPU::SDWA::SdwaSel::DWORD);
- // Copy src1_sel if present, initialize otherwise if needed
if (Src1) {
assert(AMDGPU::hasNamedOperand(SDWAOpcode, AMDGPU::OpName::src1_sel));
- MachineOperand *Src1Sel = TII->getNamedOperand(MI, AMDGPU::OpName::src1_sel);
- if (Src1Sel) {
- SDWAInst.add(*Src1Sel);
- } else {
- SDWAInst.addImm(AMDGPU::SDWA::SdwaSel::DWORD);
- }
+ SDWAInst.addImm(AMDGPU::SDWA::SdwaSel::DWORD);
}
// Check for a preserved register that needs to be copied.
- auto *DstUnused = TII->getNamedOperand(MI, AMDGPU::OpName::dst_unused);
- if (DstUnused &&
- DstUnused->getImm() == AMDGPU::SDWA::DstUnused::UNUSED_PRESERVE) {
- // We expect, if we are here, that the instruction was already in it's SDWA form,
- // with a tied operand.
- assert(Dst && Dst->isTied());
- assert(Opcode == static_cast<unsigned int>(SDWAOpcode));
- // We also expect a vdst, since sdst can't preserve.
- auto PreserveDstIdx = AMDGPU::getNamedOperandIdx(SDWAOpcode, AMDGPU::OpName::vdst);
- assert(PreserveDstIdx != -1);
-
- auto TiedIdx = MI.findTiedOperandIdx(PreserveDstIdx);
- auto Tied = MI.getOperand(TiedIdx);
-
- SDWAInst.add(Tied);
- SDWAInst->tieOperands(PreserveDstIdx, SDWAInst->getNumOperands() - 1);
- }
-
MachineInstr *Ret = SDWAInst.getInstr();
TII->fixImplicitOperands(*Ret);
return Ret;
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/64/builds/3837 Here is the relevant piece of the build log for the reference
|
…lvm#141462) In an earlier state of this code, it was possible for an existing SDWA MI to reach the code in the "createSDWAversion" function. This is no longer possible; see assert at the top of the function. Remove code that tries to handle operands on pre-existing SDWA instructions from the function.
In an earlier state of this code, it was possible for an existing SDWA MI to reach the code in the "createSDWAversion" function. This is no longer possible; see assert at the top of the function.
Remove code that tries to handle operands on pre-existing SDWA instructions from the function.