[llvm] [MachineCopyPropagation] Detect and fix suboptimal instruction order to enable optimizations (PR #98087)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 8 15:25:20 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 01ba3fa37b22828abca81011b0cb2e4cbbb8cfda 795bcd3d35efd638622996536e5673c2092d5d33 -- llvm/lib/CodeGen/MachineCopyPropagation.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
index de62f33c67..2f5e6e8b64 100644
--- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp
+++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
@@ -407,7 +407,7 @@ public:
         Copy.DefRegs.push_back(Def);
       Copy.LastSeenUseInCopy = MI;
     }
-    
+
     Dependency b{MI};
     addDependency(b);
   }
@@ -1214,7 +1214,7 @@ void MachineCopyPropagation::propagateDefs(MachineInstr &MI) {
 
     LLVM_DEBUG(dbgs() << "Number of dependencies of the copy: "
                       << PreviousDependencies->size() << "\n");
-    
+
     // Check whether the current MI has a mutual registers with the optimization
     // blocking instructions.
     bool NoDependencyWithMI =
@@ -1224,7 +1224,7 @@ void MachineCopyPropagation::propagateDefs(MachineInstr &MI) {
                     });
     if (!NoDependencyWithMI)
       continue;
-    
+
     // If there isn't any relationship between the blockers and the current MI
     // then we can start moving them.
 
@@ -1278,7 +1278,8 @@ void MachineCopyPropagation::BackwardCopyPropagateBlock(
         // Unlike forward cp, we don't invoke propagateDefs here,
         // just let forward cp do COPY-to-COPY propagation.
         if (isBackwardPropagatableCopy(*CopyOperands, *MRI)) {
-          Tracker.setDependenciesForMI(&MI, *TRI, *TII, UseCopyInstr); // Maybe it is bad to call it here
+          Tracker.setDependenciesForMI(
+              &MI, *TRI, *TII, UseCopyInstr); // Maybe it is bad to call it here
           Tracker.trackCopy(&MI, *TRI, *TII, UseCopyInstr);
           continue;
         }

``````````

</details>


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


More information about the llvm-commits mailing list