[llvm] GlobalISel lane masks merging (PR #73337)
Petar Avramovic via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 13 06:15:25 PST 2023
================
@@ -207,9 +207,31 @@ bool AMDGPUInstructionSelector::selectCOPY(MachineInstr &I) const {
return true;
}
+bool isLaneMask(Register Reg, MachineRegisterInfo *MRI,
+ const SIRegisterInfo &TRI) {
+ if (MRI->getType(Reg) != LLT::scalar(1))
+ return false;
+ const TargetRegisterClass *RC = MRI->getRegClassOrNull(Reg);
+ return RC && TRI.isSGPRClass(RC);
+}
+
bool AMDGPUInstructionSelector::selectPHI(MachineInstr &I) const {
const Register DefReg = I.getOperand(0).getReg();
const LLT DefTy = MRI->getType(DefReg);
+ // Lane mask PHIs, PHI where all register operands have sgpr register class
+ // with S1 LLT, are already selected in divergence lowering pass.
+ if (I.getOpcode() == AMDGPU::PHI && isLaneMask(DefReg, MRI, TRI)) {
----------------
petar-avramovic wrote:
Okay then, we can merge first two patches in the meantime
https://github.com/llvm/llvm-project/pull/73337
More information about the llvm-commits
mailing list