[PATCH] D153879: [AMDGPU] Handle Additional Cases in tryFoldPhiAGPR
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 27 08:27:49 PDT 2023
arsenm added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/SIFoldOperands.cpp:1644
}
+static bool isAGPRCopy(const SIRegisterInfo &TRI,
----------------
Doc comment
================
Comment at: llvm/lib/Target/AMDGPU/SIFoldOperands.cpp:1647
+ const MachineRegisterInfo &MRI, const MachineInstr &Copy,
+ Register &OutReg, unsigned &OutSubRegMask) {
+ assert(Copy.isCopy());
----------------
Don't call it SubRegMask, it's just the SubReg
================
Comment at: llvm/lib/Target/AMDGPU/SIFoldOperands.cpp:1667
+ const MachineInstr *CopySrcDef = MRI.getVRegDef(CopySrcReg);
+ if (!CopySrcDef || !CopySrcDef->isCopy())
+ return false;
----------------
We really ought to ban defless registers in SSA but you do need this for undef sources
================
Comment at: llvm/lib/Target/AMDGPU/SIFoldOperands.cpp:1762
+ Register AGPRSrc;
+ unsigned AGPRRegMask = AMDGPU::NoSubRegister;
+ if (isAGPRCopy(*TRI, *MRI, *Def, AGPRSrc, AGPRRegMask)) {
----------------
It's not a regmask, it's just a subreg index
================
Comment at: llvm/test/CodeGen/AMDGPU/fold-agpr-phis.mir:505
+ bb.2:
+ S_ENDPGM 0
+...
----------------
Could also use and end to end IR test
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153879/new/
https://reviews.llvm.org/D153879
More information about the llvm-commits
mailing list