[llvm] d86dcb7 - [AMDGPU] Return better Changed status from SIOptimizeExecMasking

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 18 02:12:58 PST 2022


Author: Jay Foad
Date: 2022-02-18T10:09:21Z
New Revision: d86dcb7ea56afff8e85998b23cbad5130f5502cd

URL: https://github.com/llvm/llvm-project/commit/d86dcb7ea56afff8e85998b23cbad5130f5502cd
DIFF: https://github.com/llvm/llvm-project/commit/d86dcb7ea56afff8e85998b23cbad5130f5502cd.diff

LOG: [AMDGPU] Return better Changed status from SIOptimizeExecMasking

Differential Revision: https://reviews.llvm.org/D120024

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/SIOptimizeExecMasking.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/SIOptimizeExecMasking.cpp b/llvm/lib/Target/AMDGPU/SIOptimizeExecMasking.cpp
index b9c839fe28ba8..9a4cc25f00085 100644
--- a/llvm/lib/Target/AMDGPU/SIOptimizeExecMasking.cpp
+++ b/llvm/lib/Target/AMDGPU/SIOptimizeExecMasking.cpp
@@ -312,6 +312,7 @@ bool SIOptimizeExecMasking::runOnMachineFunction(MachineFunction &MF) {
   //     x = s_<op>_saveexec_b64 y
   //
 
+  bool Changed = false;
   for (MachineBasicBlock &MBB : MF) {
     MachineBasicBlock::reverse_iterator I = fixTerminators(*TII, MBB);
     MachineBasicBlock::reverse_iterator E = MBB.rend();
@@ -351,6 +352,7 @@ bool SIOptimizeExecMasking::runOnMachineFunction(MachineFunction &MF) {
         LLVM_DEBUG(dbgs() << "into: " << *PrepareExecInst << '\n');
 
         CopyToExecInst->eraseFromParent();
+        Changed = true;
       }
 
       continue;
@@ -456,8 +458,9 @@ bool SIOptimizeExecMasking::runOnMachineFunction(MachineFunction &MF) {
       OtherInst->substituteRegister(CopyToExec, Exec,
                                     AMDGPU::NoSubRegister, *TRI);
     }
-  }
 
-  return true;
+    Changed = true;
+  }
 
+  return Changed;
 }


        


More information about the llvm-commits mailing list