[llvm] AMDGPU: VALU data fast-forwarding needs no s_delay (PR #205481)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 28 08:22:00 PDT 2026
================
@@ -346,6 +352,205 @@ class AMDGPUInsertDelayAlu {
return (Imm & 0x780) ? nullptr : DelayAlu;
}
+ static bool isFastForwardProducer(const MachineInstr &MI,
+ const MachineOperand &MO, Register VccReg,
+ Register ExecReg) {
+ if (!MO.isReg() || !MO.isDef())
+ return false;
+
+ if (!SIInstrInfo::isVALU(MI, /*AllowLDSDMA=*/false))
+ return false;
+
+ const TargetRegisterInfo *TRI =
+ MI.getMF()->getSubtarget().getRegisterInfo();
+ Register Reg = MO.getReg();
+ if (TRI->isSubRegisterEq(Reg, VccReg)) {
----------------
jayfoad wrote:
I think you might be able to simplify the code from here to the end of the function. All of these opcodes define exactly one SReg (either an SGPR or EXEC or VCC) so you should be able to handle them all uniformly with something like:
```
if (isSGPR()) { // assuming isSGPR includes EXEC and VCC? If not, there should be another predicate that does include them
switch (Opcode) {
case ...:
return true;
default:
return isCompare();
}
}
```
https://github.com/llvm/llvm-project/pull/205481
More information about the llvm-commits
mailing list