[llvm] [CodeGen] Extract copy-paste on PHI MachineInstr income removal. (PR #158634)
    via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Sep 15 06:29:05 PDT 2025
    
    
  
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/include/llvm/CodeGen/MachineInstrUtils.h llvm/lib/CodeGen/MachineInstrUtils.cpp llvm/lib/CodeGen/EarlyIfConversion.cpp llvm/lib/CodeGen/ModuloSchedule.cpp llvm/lib/CodeGen/TailDuplicator.cpp llvm/lib/CodeGen/UnreachableBlockElim.cpp
``````````
: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/CodeGen/EarlyIfConversion.cpp b/llvm/lib/CodeGen/EarlyIfConversion.cpp
index 4c537538a..8568c40f4 100644
--- a/llvm/lib/CodeGen/EarlyIfConversion.cpp
+++ b/llvm/lib/CodeGen/EarlyIfConversion.cpp
@@ -670,9 +670,9 @@ void SSAIfConv::rewritePHIOperands() {
 
     // Rewrite PHI operands TPred -> (DstReg, Head), remove FPred.
     for (unsigned i = PI.PHI->getNumOperands(); i != 1; i -= 2) {
-      if (PI.PHI->getOperand(i-1).getMBB() == getTPred()) {
+      if (PI.PHI->getOperand(i - 1).getMBB() == getTPred()) {
         PI.PHI->getOperand(i-1).setMBB(Head);
-        PI.PHI->getOperand(i-2).setReg(DstReg);
+        PI.PHI->getOperand(i - 2).setReg(DstReg);
       }
     }
     removePHIIncomingValueForMBB(*PI.PHI, *getFPred());
diff --git a/llvm/lib/CodeGen/MachineInstrUtils.cpp b/llvm/lib/CodeGen/MachineInstrUtils.cpp
index 79b3e615b..c6ec2d961 100644
--- a/llvm/lib/CodeGen/MachineInstrUtils.cpp
+++ b/llvm/lib/CodeGen/MachineInstrUtils.cpp
@@ -32,4 +32,3 @@ unsigned removePHIIncomingValueForMBB(MachineInstr &Phi,
 }
 
 } // end namespace llvm
-
``````````
</details>
https://github.com/llvm/llvm-project/pull/158634
    
    
More information about the llvm-commits
mailing list