[llvm] [AArch64] InsertSelect: Fold both diamond arms into chained CSEL family instructions (PR #212033)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 25 23:04:01 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/Target/AArch64/AArch64InstrInfo.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/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
index ff2db343c..a2f383615 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
@@ -1291,7 +1291,7 @@ void AArch64InstrInfo::insertSelect(MachineBasicBlock &MBB,
// Try folding simple instructions into the csel.
if (TryFold) {
unsigned NewTrueReg = 0, NewFalseReg = 0;
- unsigned TrueFoldOpc = canFoldIntoCSel(MRI, TrueReg, &NewTrueReg);
+ unsigned TrueFoldOpc = canFoldIntoCSel(MRI, TrueReg, &NewTrueReg);
unsigned FalseFoldOpc = canFoldIntoCSel(MRI, FalseReg, &NewFalseReg);
if (TrueFoldOpc && FalseFoldOpc) {
@@ -1306,22 +1306,22 @@ void AArch64InstrInfo::insertSelect(MachineBasicBlock &MBB,
.addImm(InvCC);
MRI.clearKillFlags(NewTrueReg);
// Set up the second instruction to fold FalseReg.
- TrueReg = TmpReg;
+ TrueReg = TmpReg;
FalseReg = NewFalseReg;
- Opc = FalseFoldOpc;
+ Opc = FalseFoldOpc;
MRI.clearKillFlags(NewFalseReg);
} else if (TrueFoldOpc) {
// Only TrueReg is foldable. The fold operation applies to Rm (slot 2),
// so invert the condition and swap Rn/Rm to place it correctly.
- CC = AArch64CC::getInvertedCondCode(CC);
- TrueReg = FalseReg;
+ CC = AArch64CC::getInvertedCondCode(CC);
+ TrueReg = FalseReg;
FalseReg = NewTrueReg;
- Opc = TrueFoldOpc;
+ Opc = TrueFoldOpc;
MRI.clearKillFlags(NewTrueReg);
} else if (FalseFoldOpc) {
// Only FalseReg is foldable. Direct fold into Rm, no swap needed.
FalseReg = NewFalseReg;
- Opc = FalseFoldOpc;
+ Opc = FalseFoldOpc;
MRI.clearKillFlags(NewFalseReg);
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/212033
More information about the llvm-commits
mailing list