[llvm] [MCP] Avoid Folding Spill Chains Over Across Source Clobbers (PR #207169)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 2 05:46:00 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/MachineCopyPropagation.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/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
index a9b3cf68c..c2b77f55d 100644
--- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp
+++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
@@ -1338,7 +1338,8 @@ void MachineCopyPropagation::eliminateSpillageCopies(MachineBasicBlock &MBB) {
// we put the COPY in this set to keep property#2.
DenseSet<const MachineInstr *> CopySourceInvalid;
// Track uses of a register as a source for a previous COPY
- DenseMap<const MachineInstr *, SmallVector<const MachineInstr *>> CopySourceDefCopies;
+ DenseMap<const MachineInstr *, SmallVector<const MachineInstr *>>
+ CopySourceDefCopies;
auto TryFoldSpillageCopies =
[&, this](const SmallVectorImpl<MachineInstr *> &SC,
@@ -1378,7 +1379,8 @@ void MachineCopyPropagation::eliminateSpillageCopies(MachineBasicBlock &MBB) {
}
};
- auto HasUnexpectedCopySourceDef = [&](const MachineInstr *Copy, const MachineInstr *ExpectedDef) {
+ auto HasUnexpectedCopySourceDef = [&](const MachineInstr *Copy,
+ const MachineInstr *ExpectedDef) {
auto CopySouceDefPair = CopySourceDefCopies.find(Copy);
if (CopySouceDefPair == CopySourceDefCopies.end())
return false;
@@ -1517,8 +1519,8 @@ void MachineCopyPropagation::eliminateSpillageCopies(MachineBasicBlock &MBB) {
}
auto [Dst, Src] = getDstSrcMCRegs(*CopyOperands);
- // Track potential unexpected COPY def's that use a source in the chain. These
- // cannot be folded across to preserve the original source value.
+ // Track potential unexpected COPY def's that use a source in the chain.
+ // These cannot be folded across to preserve the original source value.
if (MachineInstr *LastUseCopy = Tracker.findLastSeenUseInCopy(Dst, *TRI)) {
CopySourceDefCopies[LastUseCopy].push_back(&MI);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/207169
More information about the llvm-commits
mailing list