[llvm] [AMDGPU] Fold v_perm pair into v_swap (PR #181966)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 07:31:21 PDT 2026


================
@@ -872,11 +1054,16 @@ bool SIShrinkInstructions::run(MachineFunction &MF) {
   bool Changed = false;
 
   for (MachineBasicBlock &MBB : MF) {
+    PendingSwapMap SwapCandidates;
     MachineBasicBlock::iterator I, Next;
     for (I = MBB.begin(); I != MBB.end(); I = Next) {
       Next = std::next(I);
       MachineInstr &MI = *I;
 
+      if (!SwapCandidates.empty() &&
+          instModifiesReg(&MI, AMDGPU::EXEC, AMDGPU::NoSubRegister))
----------------
arsenm wrote:

Is the instModifiesReg check really necessary? Exec writes shouldn't appear in the middle of a block 

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


More information about the llvm-commits mailing list