[llvm] [AMDGPU] Analyze implicit reg operands when generating swaps (PR #192220)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 10:00:47 PDT 2026


================
@@ -617,12 +615,11 @@ ChangeKind SIShrinkInstructions::shrinkScalarLogicOp(MachineInstr &MI) const {
   return ChangeKind::None;
 }
 
-// This is the same as MachineInstr::readsRegister/modifiesRegister except
+// This is the same as MachineInstr::readsRegister except
 // it takes subregs into account.
-bool SIShrinkInstructions::instAccessReg(
-    iterator_range<MachineInstr::const_mop_iterator> &&R, Register Reg,
-    unsigned SubReg) const {
-  for (const MachineOperand &MO : R) {
+bool SIShrinkInstructions::instReadsReg(const MachineInstr *MI, Register Reg,
+                                        unsigned SubReg) const {
+  for (const MachineOperand &MO : MI->all_uses()) {
     if (!MO.isReg())
       continue;
----------------
LU-JOHN wrote:

Removed isReg test.

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


More information about the llvm-commits mailing list