[llvm-branch-commits] [LoongArch] Port PreRAExpandPsuedoInstPass (PR #245242)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Nov 23 06:49:16 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 h,cpp -- llvm/lib/Target/LoongArch/LoongArch.h llvm/lib/Target/LoongArch/LoongArchCodeGenPassBuilder.cpp llvm/lib/Target/LoongArch/LoongArchExpandPseudoInsts.cpp llvm/lib/Target/LoongArch/LoongArchTargetMachine.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/LoongArch/LoongArchExpandPseudoInsts.cpp b/llvm/lib/Target/LoongArch/LoongArchExpandPseudoInsts.cpp
index 5bdcf3daf..65e3454dd 100644
--- a/llvm/lib/Target/LoongArch/LoongArchExpandPseudoInsts.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchExpandPseudoInsts.cpp
@@ -101,11 +101,13 @@ static bool expandPcaxxu12iInstPair(MachineBasicBlock &MBB,
   return true;
 }
 
-static bool expandLargeAddressLoad(
-    MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
-    MachineBasicBlock::iterator &NextMBBI, unsigned LastOpcode,
-    unsigned IdentifyingMO, const MachineOperand &Symbol, Register DestReg,
-    bool EraseFromParent, const LoongArchInstrInfo *TII) {
+static bool expandLargeAddressLoad(MachineBasicBlock &MBB,
+                                   MachineBasicBlock::iterator MBBI,
+                                   MachineBasicBlock::iterator &NextMBBI,
+                                   unsigned LastOpcode, unsigned IdentifyingMO,
+                                   const MachineOperand &Symbol,
+                                   Register DestReg, bool EraseFromParent,
+                                   const LoongArchInstrInfo *TII) {
   // Code Sequence:
   //
   // Part1: pcalau12i  $scratch, %MO1(sym)
@@ -194,19 +196,22 @@ static bool expandLargeAddressLoad(
   return true;
 }
 
-static bool expandLargeAddressLoad(
-    MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
-    MachineBasicBlock::iterator &NextMBBI, unsigned LastOpcode,
-    unsigned IdentifyingMO, const LoongArchInstrInfo *TII) {
+static bool expandLargeAddressLoad(MachineBasicBlock &MBB,
+                                   MachineBasicBlock::iterator MBBI,
+                                   MachineBasicBlock::iterator &NextMBBI,
+                                   unsigned LastOpcode, unsigned IdentifyingMO,
+                                   const LoongArchInstrInfo *TII) {
   MachineInstr &MI = *MBBI;
   return expandLargeAddressLoad(MBB, MBBI, NextMBBI, LastOpcode, IdentifyingMO,
                                 MI.getOperand(2), MI.getOperand(0).getReg(),
                                 true, TII);
 }
 
-static bool expandLoadAddressPcrel(
-    MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
-    MachineBasicBlock::iterator &NextMBBI, const LoongArchInstrInfo *TII, bool Large = false) {
+static bool expandLoadAddressPcrel(MachineBasicBlock &MBB,
+                                   MachineBasicBlock::iterator MBBI,
+                                   MachineBasicBlock::iterator &NextMBBI,
+                                   const LoongArchInstrInfo *TII,
+                                   bool Large = false) {
   if (Large)
     // Emit the 5-insn large address load sequence with the `%pc` family of
     // relocs.
@@ -270,9 +275,10 @@ static bool expandLoadAddressGot(MachineBasicBlock &MBB,
                                  FlagsHi, FlagsLo, TII);
 }
 
-static bool expandLoadAddressTLSLE(
-    MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
-    MachineBasicBlock::iterator &NextMBBI, const LoongArchInstrInfo *TII) {
+static bool expandLoadAddressTLSLE(MachineBasicBlock &MBB,
+                                   MachineBasicBlock::iterator MBBI,
+                                   MachineBasicBlock::iterator &NextMBBI,
+                                   const LoongArchInstrInfo *TII) {
   // Code Sequence:
   // lu12i.w $rd, %le_hi20_r(sym)
   // add.w/d $rd, $rd, $tp, %le_add_r(sym)
@@ -549,9 +555,10 @@ static bool expandLoadAddressTLSDesc(MachineBasicBlock &MBB,
   return true;
 }
 
-static bool expandFunctionCALL(
-    MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
-    MachineBasicBlock::iterator &NextMBBI, bool IsTailCall, const LoongArchInstrInfo *TII) {
+static bool expandFunctionCALL(MachineBasicBlock &MBB,
+                               MachineBasicBlock::iterator MBBI,
+                               MachineBasicBlock::iterator &NextMBBI,
+                               bool IsTailCall, const LoongArchInstrInfo *TII) {
   MachineFunction *MF = MBB.getParent();
   MachineInstr &MI = *MBBI;
 
@@ -597,8 +604,8 @@ static bool expandFunctionCALL(
   llvm_unreachable("Unexpected code model");
 }
 
-static void annotateTableJump(
-    MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) {
+static void annotateTableJump(MachineBasicBlock &MBB,
+                              MachineBasicBlock::iterator MBBI) {
   MachineFunction *MF = MBB.getParent();
   MachineRegisterInfo &MRI = MBB.getParent()->getRegInfo();
 
@@ -655,9 +662,10 @@ static bool expandMOVCF2GRViaFR(MachineBasicBlock &MBB,
   return true;
 }
 
-static bool expandMIPreRA(
-    MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
-    MachineBasicBlock::iterator &NextMBBI, const LoongArchInstrInfo *TII) {
+static bool expandMIPreRA(MachineBasicBlock &MBB,
+                          MachineBasicBlock::iterator MBBI,
+                          MachineBasicBlock::iterator &NextMBBI,
+                          const LoongArchInstrInfo *TII) {
   switch (MBBI->getOpcode()) {
   case LoongArch::PseudoLA_PCREL:
     return expandLoadAddressPcrel(MBB, MBBI, NextMBBI, TII);

``````````

</details>


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


More information about the llvm-branch-commits mailing list