[llvm] [RegisterCoalescer] Narrow full COPYs with dead destination lanes (PR #199631)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 30 01:50:58 PDT 2026


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 origin/main HEAD --extensions cpp -- llvm/lib/CodeGen/RegisterCoalescer.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp
index bed0d4d8a..1e1479bab 100644
--- a/llvm/lib/CodeGen/RegisterCoalescer.cpp
+++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp
@@ -2220,8 +2220,8 @@ bool RegisterCoalescer::joinCopy(
       if (removePartialRedundancy(CP, *CopyMI))
         return true;
 
-    // Narrow a full `%dst = COPY %src` whose destination has lanes that are dead
-    // at the copy (overwritten before use): the dead-lane def causes false
+    // Narrow a full `%dst = COPY %src` whose destination has lanes that are
+    // dead at the copy (overwritten before use): the dead-lane def causes false
     // interference, so narrow to the surviving lanes and let the overwriting
     // defs coalesce.
     if (!CP.isPartial() && !CP.isPhys()) {
@@ -2245,7 +2245,8 @@ bool RegisterCoalescer::joinCopy(
           const TargetRegisterClass *SrcRC = MRI->getRegClass(CopySrcReg);
           const TargetRegisterClass *DstRC = MRI->getRegClass(CopyDstReg);
           SmallVector<unsigned, 4> SubRegIdxs;
-          if (TRI->getCoveringSubRegIndexes(SrcRC, SurvivingLanes, SubRegIdxs) &&
+          if (TRI->getCoveringSubRegIndexes(SrcRC, SurvivingLanes,
+                                            SubRegIdxs) &&
               SubRegIdxs.size() == 1 &&
               TRI->getSubClassWithSubReg(DstRC, SubRegIdxs[0])) {
             unsigned SubIdx = SubRegIdxs[0];

``````````

</details>


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


More information about the llvm-commits mailing list