diff options
author | Christudasan Devadasan <christudasan.devadasan@amd.com> | 2023-11-16 10:30:03 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-16 10:30:03 +0530 |
commit | ce7fd498ed91344c23f0864bbd5b84d65eaae3ef (patch) | |
tree | 0d297ede1e4b78147282db94e2e169eaf97cbabc /llvm/lib/CodeGen | |
parent | e8fc282ff26b4d1d71a316bf036fc486b420ea19 (diff) | |
download | llvm-ce7fd498ed91344c23f0864bbd5b84d65eaae3ef.zip llvm-ce7fd498ed91344c23f0864bbd5b84d65eaae3ef.tar.gz llvm-ce7fd498ed91344c23f0864bbd5b84d65eaae3ef.tar.bz2 |
[AMDGPU] RA inserted scalar instructions can be at the BB top (#72140)
We adjust the insertion point at the BB top for spills/copies during RA
to ensure they are placed after the exec restore instructions required
for the divergent control flow execution. This is, however, required
only for the vector operations. The insertions for scalar registers can
still go to the BB top.
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/CodeGen/InlineSpiller.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SplitKit.cpp | 6 |
4 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp b/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp index 75504ef..4d668c5 100644 --- a/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp +++ b/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp @@ -461,7 +461,8 @@ public: if (EHPad && !RC.hasReload(Reg, RegToSlotIdx[Reg], EHPad)) { RC.recordReload(Reg, RegToSlotIdx[Reg], EHPad); - auto EHPadInsertPoint = EHPad->SkipPHIsLabelsAndDebug(EHPad->begin()); + auto EHPadInsertPoint = + EHPad->SkipPHIsLabelsAndDebug(EHPad->begin(), Reg); insertReloadBefore(Reg, EHPadInsertPoint, EHPad); LLVM_DEBUG(dbgs() << "...also reload at EHPad " << printMBBReference(*EHPad) << "\n"); diff --git a/llvm/lib/CodeGen/InlineSpiller.cpp b/llvm/lib/CodeGen/InlineSpiller.cpp index 71d58b2..2740265 100644 --- a/llvm/lib/CodeGen/InlineSpiller.cpp +++ b/llvm/lib/CodeGen/InlineSpiller.cpp @@ -469,7 +469,7 @@ bool InlineSpiller::hoistSpillInsideBB(LiveInterval &SpillLI, MachineBasicBlock *MBB = LIS.getMBBFromIndex(SrcVNI->def); MachineBasicBlock::iterator MII; if (SrcVNI->isPHIDef()) - MII = MBB->SkipPHIsLabelsAndDebug(MBB->begin()); + MII = MBB->SkipPHIsLabelsAndDebug(MBB->begin(), SrcReg); else { MachineInstr *DefMI = LIS.getInstructionFromIndex(SrcVNI->def); assert(DefMI && "Defining instruction disappeared"); diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index d9e2268..4410fb7 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -223,13 +223,13 @@ MachineBasicBlock::SkipPHIsAndLabels(MachineBasicBlock::iterator I) { MachineBasicBlock::iterator MachineBasicBlock::SkipPHIsLabelsAndDebug(MachineBasicBlock::iterator I, - bool SkipPseudoOp) { + Register Reg, bool SkipPseudoOp) { const TargetInstrInfo *TII = getParent()->getSubtarget().getInstrInfo(); iterator E = end(); while (I != E && (I->isPHI() || I->isPosition() || I->isDebugInstr() || (SkipPseudoOp && I->isPseudoProbe()) || - TII->isBasicBlockPrologue(*I))) + TII->isBasicBlockPrologue(*I, Reg))) ++I; // FIXME: This needs to change if we wish to bundle labels / dbg_values // inside the bundle. diff --git a/llvm/lib/CodeGen/SplitKit.cpp b/llvm/lib/CodeGen/SplitKit.cpp index 1664c30..b1c8622 100644 --- a/llvm/lib/CodeGen/SplitKit.cpp +++ b/llvm/lib/CodeGen/SplitKit.cpp @@ -795,8 +795,10 @@ SlotIndex SplitEditor::leaveIntvAtTop(MachineBasicBlock &MBB) { return Start; } - VNInfo *VNI = defFromParent(0, ParentVNI, Start, MBB, - MBB.SkipPHIsLabelsAndDebug(MBB.begin())); + unsigned RegIdx = 0; + Register Reg = LIS.getInterval(Edit->get(RegIdx)).reg(); + VNInfo *VNI = defFromParent(RegIdx, ParentVNI, Start, MBB, + MBB.SkipPHIsLabelsAndDebug(MBB.begin(), Reg)); RegAssign.insert(Start, VNI->def, OpenIdx); LLVM_DEBUG(dump()); return VNI->def; |