[llvm-branch-commits] [llvm] [AMDGPU] Make SIShrinkInstructions pass return valid changed state (PR #168833)

Vikram Hegde via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Nov 20 21:56:22 PST 2025


================
@@ -527,14 +534,16 @@ void SIShrinkInstructions::shrinkMadFma(MachineInstr &MI) const {
     TII->removeModOperands(MI);
     MI.setDesc(TII->get(NewOpcode));
   }
+  return true;
 }
 
 /// Attempt to shrink AND/OR/XOR operations requiring non-inlineable literals.
 /// For AND or OR, try using S_BITSET{0,1} to clear or set bits.
 /// If the inverse of the immediate is legal, use ANDN2, ORN2 or
 /// XNOR (as a ^ b == ~(a ^ ~b)).
 /// \returns true if the caller should continue the machine function iterator
-bool SIShrinkInstructions::shrinkScalarLogicOp(MachineInstr &MI) const {
+bool SIShrinkInstructions::shrinkScalarLogicOp(MachineInstr &MI,
+                                               bool &Changed) const {
----------------
vikramRH wrote:

On second thought, the API returns if machine iterator should be moved. this is incompatible with the whether any change has been made (pass can look for further optimization opportunities even after a change). I have updated the API to return changed state to be consistent with others.

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


More information about the llvm-branch-commits mailing list