[llvm] [CodeGen] Use findPHICopyInsertPoint to put insert point (PR #155421)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 26 08:59:27 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 HEAD~1 HEAD --extensions cpp,h -- llvm/include/llvm/CodeGen/TailDuplicator.h llvm/lib/CodeGen/PHIEliminationUtils.cpp llvm/lib/CodeGen/TailDuplicator.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/CodeGen/TailDuplicator.h b/llvm/include/llvm/CodeGen/TailDuplicator.h
index 0efe5ea87..9383ba6ce 100644
--- a/llvm/include/llvm/CodeGen/TailDuplicator.h
+++ b/llvm/include/llvm/CodeGen/TailDuplicator.h
@@ -121,9 +121,10 @@ private:
SmallVectorImpl<MachineBasicBlock *> &TDBBs,
SmallVectorImpl<MachineInstr *> &Copies,
SmallVectorImpl<MachineBasicBlock *> *CandidatePtr);
- void appendCopies(MachineBasicBlock *MBB, MachineBasicBlock *SuccMBB,
- SmallVectorImpl<std::pair<Register, RegSubRegPair>> &CopyInfos,
- SmallVectorImpl<MachineInstr *> &Copies);
+ void
+ appendCopies(MachineBasicBlock *MBB, MachineBasicBlock *SuccMBB,
+ SmallVectorImpl<std::pair<Register, RegSubRegPair>> &CopyInfos,
+ SmallVectorImpl<MachineInstr *> &Copies);
void removeDeadBlock(
MachineBasicBlock *MBB,
diff --git a/llvm/lib/CodeGen/TailDuplicator.cpp b/llvm/lib/CodeGen/TailDuplicator.cpp
index f4414ba6c..d9314146f 100644
--- a/llvm/lib/CodeGen/TailDuplicator.cpp
+++ b/llvm/lib/CodeGen/TailDuplicator.cpp
@@ -653,9 +653,9 @@ bool TailDuplicator::shouldTailDuplicate(bool IsSimple,
return false;
// Note: TailDuplicator::appendCopies has been enhanced to properly handle
- // INLINEASM_BR instructions by ensuring COPYs are always placed before them,
- // fixing the issue described in the original FIXME comment. Blocks containing
- // INLINEASM_BR can now be safely tail duplicated.
+ // INLINEASM_BR instructions by ensuring COPYs are always placed before
+ // them, fixing the issue described in the original FIXME comment. Blocks
+ // containing INLINEASM_BR can now be safely tail duplicated.
if (MI.isBundle())
InstrCount += MI.getBundleSize();
@@ -1064,16 +1064,18 @@ bool TailDuplicator::tailDuplicate(bool IsSimple, MachineBasicBlock *TailBB,
/// At the end of the block \p MBB generate COPY instructions between registers
/// described by \p CopyInfos. Append resulting instructions to \p Copies.
-void TailDuplicator::appendCopies(MachineBasicBlock *MBB, MachineBasicBlock *SuccMBB,
- SmallVectorImpl<std::pair<Register, RegSubRegPair>> &CopyInfos,
- SmallVectorImpl<MachineInstr*> &Copies) {
+void TailDuplicator::appendCopies(
+ MachineBasicBlock *MBB, MachineBasicBlock *SuccMBB,
+ SmallVectorImpl<std::pair<Register, RegSubRegPair>> &CopyInfos,
+ SmallVectorImpl<MachineInstr *> &Copies) {
const MCInstrDesc &CopyD = TII->get(TargetOpcode::COPY);
-
+
for (auto &CI : CopyInfos) {
// Use findPHICopyInsertPoint as the starting point, but ensure we don't
// place COPYs after INLINEASM_BR instructions
- MachineBasicBlock::iterator Loc = findPHICopyInsertPoint(MBB, SuccMBB, CI.second.Reg);
-
+ MachineBasicBlock::iterator Loc =
+ findPHICopyInsertPoint(MBB, SuccMBB, CI.second.Reg);
+
auto C = BuildMI(*MBB, Loc, DebugLoc(), CopyD, CI.first)
.addReg(CI.second.Reg, 0, CI.second.SubReg);
Copies.push_back(C);
``````````
</details>
https://github.com/llvm/llvm-project/pull/155421
More information about the llvm-commits
mailing list