[llvm] [AMDGPU] Analyze REG_SEQUENCE To Remove Redundant CMP Instructions (PR #167364)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 23 11:33:21 PST 2026


================
@@ -1313,6 +1313,34 @@ Register SIInstrInfo::insertNE(MachineBasicBlock *MBB,
   return Reg;
 }
 
+MachineInstr *
+SIInstrInfo::pierceThroughRegSequence(const MachineInstr &MI) const {
+  if (MI.getOpcode() != AMDGPU::REG_SEQUENCE || MI.getNumOperands() != 5)
+    return nullptr;
+
+  const MachineRegisterInfo &MRI = MI.getParent()->getParent()->getRegInfo();
+  int64_t SubRegValues[2];
+  bool SubRegIsConst[2];
+  MachineInstr *RealDefs[2];
+  for (unsigned I : {2, 4}) {
+    unsigned ArrayIdx = MI.getOperand(I).getImm() == AMDGPU::sub0 ? 0 : 1;
----------------
arsenm wrote:

This is assuming a reg_sequence of only sub0 and sub1. I don't see a class or subregister compatibility check, so this could have been something else like %vgpr_32 = reg_sequence lo16, hi16

https://github.com/llvm/llvm-project/pull/167364


More information about the llvm-commits mailing list