[llvm] [BOLT][AArch64] Add a unittest for compare-and-branch inversion. (PR #181177)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 12 08:39:09 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 -- bolt/unittests/Core/MCPlusBuilder.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/bolt/unittests/Core/MCPlusBuilder.cpp b/bolt/unittests/Core/MCPlusBuilder.cpp
index e11347a8c..a0fcfd798 100644
--- a/bolt/unittests/Core/MCPlusBuilder.cpp
+++ b/bolt/unittests/Core/MCPlusBuilder.cpp
@@ -130,27 +130,31 @@ TEST_P(MCPlusBuilderTester, AArch64_ReverseCompAndBranch) {
 
   // cbgt x0, #0, target
   MCInst NeedsImmInc = MCInstBuilder(AArch64::CBGTXri)
-      .addReg(AArch64::X0)
-      .addImm(0)
-      .addExpr(MCSymbolRefExpr::create(TargetBB->getLabel(), *BC->Ctx.get()));
+                           .addReg(AArch64::X0)
+                           .addImm(0)
+                           .addExpr(MCSymbolRefExpr::create(
+                               TargetBB->getLabel(), *BC->Ctx.get()));
   BB->addInstruction(NeedsImmInc);
   // cblo x0, #1, target
   MCInst NeedsImmDec = MCInstBuilder(AArch64::CBLOXri)
-      .addReg(AArch64::X0)
-      .addImm(1)
-      .addExpr(MCSymbolRefExpr::create(TargetBB->getLabel(), *BC->Ctx.get()));
+                           .addReg(AArch64::X0)
+                           .addImm(1)
+                           .addExpr(MCSymbolRefExpr::create(
+                               TargetBB->getLabel(), *BC->Ctx.get()));
   BB->addInstruction(NeedsImmDec);
   // cbge x0, x1, target
   MCInst NeedsRegSwap = MCInstBuilder(AArch64::CBGEXrr)
-      .addReg(AArch64::X0)
-      .addReg(AArch64::X1)
-      .addExpr(MCSymbolRefExpr::create(TargetBB->getLabel(), *BC->Ctx.get()));
+                            .addReg(AArch64::X0)
+                            .addReg(AArch64::X1)
+                            .addExpr(MCSymbolRefExpr::create(
+                                TargetBB->getLabel(), *BC->Ctx.get()));
   BB->addInstruction(NeedsRegSwap);
   // cbgt x0, #63, target
   MCInst Irreversible = MCInstBuilder(AArch64::CBGTXri)
-      .addReg(AArch64::X0)
-      .addImm(63)
-      .addExpr(MCSymbolRefExpr::create(TargetBB->getLabel(), *BC->Ctx.get()));
+                            .addReg(AArch64::X0)
+                            .addImm(63)
+                            .addExpr(MCSymbolRefExpr::create(
+                                TargetBB->getLabel(), *BC->Ctx.get()));
   BB->addInstruction(Irreversible);
 
   auto II = BB->begin();

``````````

</details>


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


More information about the llvm-commits mailing list