[llvm] 5ee0fb7 - [NFC][AMDGPU] Some cleanups in the SIOptimizeExecMasking pass.

Thomas Symalla via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 09:17:08 PDT 2022


Author: Thomas Symalla
Date: 2022-08-23T18:16:47+02:00
New Revision: 5ee0fb7ed234ee5ccb83115ebd78b16d63c8952e

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

LOG: [NFC][AMDGPU] Some cleanups in the SIOptimizeExecMasking pass.

Fix typos and remove an unused argument.

Reviewed By: foad

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

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 19a83ad53e2ed..04c9a6457944c 100644
--- a/llvm/lib/Target/AMDGPU/SIOptimizeExecMasking.cpp
+++ b/llvm/lib/Target/AMDGPU/SIOptimizeExecMasking.cpp
@@ -39,8 +39,8 @@ class SIOptimizeExecMasking : public MachineFunctionPass {
   MachineBasicBlock::reverse_iterator
   fixTerminators(MachineBasicBlock &MBB) const;
   MachineBasicBlock::reverse_iterator
-  findExecCopy(MachineBasicBlock &MBB, MachineBasicBlock::reverse_iterator I,
-               unsigned CopyToExec) const;
+  findExecCopy(MachineBasicBlock &MBB,
+               MachineBasicBlock::reverse_iterator I) const;
 
   bool isRegisterInUseBetween(MachineInstr &Stop, MachineInstr &Start,
                               MCRegister Reg, bool UseLiveOuts = false,
@@ -296,10 +296,8 @@ SIOptimizeExecMasking::fixTerminators(MachineBasicBlock &MBB) const {
   return FirstNonTerm;
 }
 
-MachineBasicBlock::reverse_iterator
-SIOptimizeExecMasking::findExecCopy(MachineBasicBlock &MBB,
-                                    MachineBasicBlock::reverse_iterator I,
-                                    unsigned CopyToExec) const {
+MachineBasicBlock::reverse_iterator SIOptimizeExecMasking::findExecCopy(
+    MachineBasicBlock &MBB, MachineBasicBlock::reverse_iterator I) const {
   const unsigned InstLimit = 25;
 
   auto E = MBB.rend();
@@ -370,7 +368,6 @@ bool SIOptimizeExecMasking::isRegisterInUseBetween(MachineInstr &Stop,
     LR.addLiveOuts(*Stop.getParent());
 
   MachineBasicBlock::reverse_iterator A(Start);
-  MachineBasicBlock::reverse_iterator E(Stop);
 
   if (IgnoreStart)
     ++A;
@@ -425,7 +422,7 @@ bool SIOptimizeExecMasking::optimizeExecSequence() {
 
     // Scan backwards to find the def.
     auto *CopyToExecInst = &*I;
-    auto CopyFromExecInst = findExecCopy(MBB, I, CopyToExec);
+    auto CopyFromExecInst = findExecCopy(MBB, I);
     if (CopyFromExecInst == E) {
       auto PrepareExecInst = std::next(I);
       if (PrepareExecInst == E)
@@ -635,9 +632,9 @@ void SIOptimizeExecMasking::tryRecordVCmpxAndSaveexecSequence(
     return;
 
   // Tries to find a possibility to optimize a v_cmp ..., s_and_saveexec
-  // sequence by looking at an instance of a s_and_saveexec instruction. Returns
-  // a pointer to the v_cmp instruction if it is safe to replace the sequence
-  // (see the conditions in the function body). This is after register
+  // sequence by looking at an instance of an s_and_saveexec instruction.
+  // Returns a pointer to the v_cmp instruction if it is safe to replace the
+  // sequence (see the conditions in the function body). This is after register
   // allocation, so some checks on operand dependencies need to be considered.
   MachineInstr *VCmp = nullptr;
 
@@ -669,7 +666,7 @@ void SIOptimizeExecMasking::tryRecordVCmpxAndSaveexecSequence(
     return;
 
   // Don't do the transformation if the destination operand is included in
-  // it's MBB Live-outs, meaning it's used in any of it's successors, leading
+  // it's MBB Live-outs, meaning it's used in any of its successors, leading
   // to incorrect code if the v_cmp and therefore the def of
   // the dest operand is removed.
   if (isLiveOut(*VCmp->getParent(), VCmpDest->getReg()))


        


More information about the llvm-commits mailing list