aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
authorPetar Avramovic <Petar.Avramovic@amd.com>2023-10-04 13:58:47 +0200
committerPetar Avramovic <Petar.Avramovic@amd.com>2023-10-06 15:00:08 +0200
commit2fa7d652d02ae5da0d32d63c4258705eadab1576 (patch)
treee4357c0b510667a4da94b54f05a1f3389af865db /llvm/lib/CodeGen/MachineBasicBlock.cpp
parent2d7fe90a3eb8b31bc02ee4407b3e74336ac729fc (diff)
downloadllvm-2fa7d652d02ae5da0d32d63c4258705eadab1576.zip
llvm-2fa7d652d02ae5da0d32d63c4258705eadab1576.tar.gz
llvm-2fa7d652d02ae5da0d32d63c4258705eadab1576.tar.bz2
AMDGPU: Fix temporal divergence introduced by machine-sink (#67456)
Temporal divergence that was present in input or introduced in IR transforms, like code-sinking or LICM, is handled in SIFixSGPRCopies by changing sgpr source instr to vgpr instr. After 5b657f5, that moved LICM after AMDGPUCodeGenPrepare, machine-sinking can introduce temporal divergence by sinking instructions outside of the cycle. Add isSafeToSink callback in TargetInstrInfo.
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineBasicBlock.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index 280ced6..7d3d8b6 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -960,6 +960,10 @@ const MachineBasicBlock *MachineBasicBlock::getSingleSuccessor() const {
return Successors.size() == 1 ? Successors[0] : nullptr;
}
+const MachineBasicBlock *MachineBasicBlock::getSinglePredecessor() const {
+ return Predecessors.size() == 1 ? Predecessors[0] : nullptr;
+}
+
MachineBasicBlock *MachineBasicBlock::getFallThrough(bool JumpToFallThrough) {
MachineFunction::iterator Fallthrough = getIterator();
++Fallthrough;