[llvm] [NewPM] Port for AArch64A57FPLoadBalancing (PR #190652)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 13:44:43 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,h -- llvm/lib/Target/AArch64/AArch64.h llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp llvm/lib/Target/AArch64/AArch64TargetMachine.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/AArch64.h b/llvm/lib/Target/AArch64/AArch64.h
index 6c6890771..ad8def2cf 100644
--- a/llvm/lib/Target/AArch64/AArch64.h
+++ b/llvm/lib/Target/AArch64/AArch64.h
@@ -97,7 +97,7 @@ FunctionPass *createAArch64StackTaggingPreRAPass();
 ModulePass *createAArch64Arm64ECCallLoweringPass();
 
 void initializeAArch64A53Fix835769LegacyPass(PassRegistry &);
-void initializeAArch64A57FPLoadBalancingLegacyPass(PassRegistry&);
+void initializeAArch64A57FPLoadBalancingLegacyPass(PassRegistry &);
 void initializeAArch64AdvSIMDScalarLegacyPass(PassRegistry &);
 void initializeAArch64AsmPrinterPass(PassRegistry &);
 void initializeAArch64PointerAuthLegacyPass(PassRegistry &);
@@ -139,7 +139,8 @@ void initializeAArch64SRLTDefineSuperRegsPass(PassRegistry &);
 void initializeSVEIntrinsicOptsPass(PassRegistry &);
 void initializeAArch64Arm64ECCallLoweringPass(PassRegistry &);
 
-class AArch64A57FPLoadBalancingPass : public PassInfoMixin<AArch64A57FPLoadBalancingPass> {
+class AArch64A57FPLoadBalancingPass
+    : public PassInfoMixin<AArch64A57FPLoadBalancingPass> {
 public:
   PreservedAnalyses run(MachineFunction &MF,
                         MachineFunctionAnalysisManager &MFAM);
diff --git a/llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp b/llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp
index d8d045a47..1364ca7bb 100644
--- a/llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp
+++ b/llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp
@@ -115,17 +115,17 @@ private:
   RegisterClassInfo RCI;
 
   bool runOnBasicBlock(MachineBasicBlock &MBB);
-  bool colorChainSet(std::vector<Chain*> GV, MachineBasicBlock &MBB,
+  bool colorChainSet(std::vector<Chain *> GV, MachineBasicBlock &MBB,
                      int &Balance);
   bool colorChain(Chain *G, Color C, MachineBasicBlock &MBB);
   int scavengeRegister(Chain *G, Color C, MachineBasicBlock &MBB);
   void scanInstruction(MachineInstr *MI, unsigned Idx,
-                       std::map<unsigned, Chain*> &Active,
+                       std::map<unsigned, Chain *> &Active,
                        std::vector<std::unique_ptr<Chain>> &AllChains);
   void maybeKillChain(MachineOperand &MO, unsigned Idx,
-                      std::map<unsigned, Chain*> &RegChains);
+                      std::map<unsigned, Chain *> &RegChains);
   Color getColor(unsigned Register);
-  Chain *getAndEraseNext(Color PreferredColor, std::vector<Chain*> &L);
+  Chain *getAndEraseNext(Color PreferredColor, std::vector<Chain *> &L);
 };
 
 class AArch64A57FPLoadBalancingLegacy : public MachineFunctionPass {
@@ -333,8 +333,9 @@ bool AArch64A57FPLoadBalancingLegacy::runOnMachineFunction(MachineFunction &F) {
   return Impl.run(F);
 }
 
-PreservedAnalyses AArch64A57FPLoadBalancingPass::run(MachineFunction &MF,
-                                                     MachineFunctionAnalysisManager &MFAM) {
+PreservedAnalyses
+AArch64A57FPLoadBalancingPass::run(MachineFunction &MF,
+                                   MachineFunctionAnalysisManager &MFAM) {
   AArch64A57FPLoadBalancingImpl Impl;
   if (Impl.run(MF))
     return PreservedAnalyses::none();
@@ -417,7 +418,7 @@ bool AArch64A57FPLoadBalancingImpl::runOnBasicBlock(MachineBasicBlock &MBB) {
 }
 
 Chain *AArch64A57FPLoadBalancingImpl::getAndEraseNext(Color PreferredColor,
-                                                  std::vector<Chain*> &L) {
+                                                      std::vector<Chain *> &L) {
   if (L.empty())
     return nullptr;
 
@@ -452,9 +453,9 @@ Chain *AArch64A57FPLoadBalancingImpl::getAndEraseNext(Color PreferredColor,
   return Ch;
 }
 
-bool AArch64A57FPLoadBalancingImpl::colorChainSet(std::vector<Chain*> GV,
-                                              MachineBasicBlock &MBB,
-                                              int &Parity) {
+bool AArch64A57FPLoadBalancingImpl::colorChainSet(std::vector<Chain *> GV,
+                                                  MachineBasicBlock &MBB,
+                                                  int &Parity) {
   bool Changed = false;
   LLVM_DEBUG(dbgs() << "colorChainSet(): #sets=" << GV.size() << "\n");
 
@@ -510,7 +511,7 @@ bool AArch64A57FPLoadBalancingImpl::colorChainSet(std::vector<Chain*> GV,
 }
 
 int AArch64A57FPLoadBalancingImpl::scavengeRegister(Chain *G, Color C,
-                                                MachineBasicBlock &MBB) {
+                                                    MachineBasicBlock &MBB) {
   // Can we find an appropriate register that is available throughout the life
   // of the chain? Simulate liveness backwards until the end of the chain.
   LiveRegUnits Units(*TRI);
@@ -544,7 +545,7 @@ int AArch64A57FPLoadBalancingImpl::scavengeRegister(Chain *G, Color C,
 }
 
 bool AArch64A57FPLoadBalancingImpl::colorChain(Chain *G, Color C,
-                                           MachineBasicBlock &MBB) {
+                                               MachineBasicBlock &MBB) {
   bool Changed = false;
   LLVM_DEBUG(dbgs() << " - colorChain(" << G->str() << ", "
                     << ColorNames[(int)C] << ")\n");
@@ -693,8 +694,9 @@ void AArch64A57FPLoadBalancingImpl::scanInstruction(
   }
 }
 
-void AArch64A57FPLoadBalancingImpl::maybeKillChain(MachineOperand &MO, unsigned Idx,
-               std::map<unsigned, Chain*> &ActiveChains) {
+void AArch64A57FPLoadBalancingImpl::maybeKillChain(
+    MachineOperand &MO, unsigned Idx,
+    std::map<unsigned, Chain *> &ActiveChains) {
   // Given an operand and the set of active chains (keyed by register),
   // determine if a chain should be ended and remove from ActiveChains.
   MachineInstr *MI = MO.getParent();

``````````

</details>


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


More information about the llvm-commits mailing list