[llvm] [AMDGPU] Fold v_perm pair into v_swap (PR #181966)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 20 10:18:10 PST 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/Target/AMDGPU/SIShrinkInstructions.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/Target/AMDGPU/SIShrinkInstructions.cpp b/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
index 48c87be44..762496469 100644
--- a/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
+++ b/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
@@ -39,9 +39,8 @@ class SIShrinkInstructions {
const SIRegisterInfo *TRI;
bool IsPostRA;
- using PendingSwapMap =
- SmallDenseMap<std::pair<uint64_t, uint64_t>,
- std::pair<MachineInstr *, uint32_t>, 4>;
+ using PendingSwapMap = SmallDenseMap<std::pair<uint64_t, uint64_t>,
+ std::pair<MachineInstr *, uint32_t>, 4>;
bool foldImmediates(MachineInstr &MI, bool TryToCommute = true) const;
bool shouldShrinkTrue16(MachineInstr &MI) const;
@@ -851,8 +850,9 @@ MachineInstr *SIShrinkInstructions::matchSwap(MachineInstr &MovT) const {
return nullptr;
}
-MachineInstr *SIShrinkInstructions::matchSwapB16(
- MachineInstr &Perm, PendingSwapMap &SwapCandidates) const {
+MachineInstr *
+SIShrinkInstructions::matchSwapB16(MachineInstr &Perm,
+ PendingSwapMap &SwapCandidates) const {
assert(Perm.getOpcode() == AMDGPU::V_PERM_B32_e64);
if (IsPostRA)
return nullptr;
@@ -955,9 +955,9 @@ MachineInstr *SIShrinkInstructions::matchSwapB16(
};
// Allow for paired v_perms to have swapped src0 and src1 operands.
std::pair<uint64_t, uint64_t> Key = {PackRegKey(Src0Reg, Src0Sub),
- PackRegKey(Src1Reg, Src1Sub)};
+ PackRegKey(Src1Reg, Src1Sub)};
std::pair<uint64_t, uint64_t> RevKey = {PackRegKey(Src1Reg, Src1Sub),
- PackRegKey(Src0Reg, Src0Sub)};
+ PackRegKey(Src0Reg, Src0Sub)};
// Current v_perm is now candidate. Search for another v_perm with same src0
// and src1 operands or record current v_perm and continue.
``````````
</details>
https://github.com/llvm/llvm-project/pull/181966
More information about the llvm-commits
mailing list