diff options
author | Baptiste Saleil <baptiste.saleil@amd.com> | 2022-06-23 10:16:20 -0400 |
---|---|---|
committer | Baptiste Saleil <baptiste.saleil@amd.com> | 2022-06-23 10:53:21 -0400 |
commit | 79e77a9f39f02a18e839f8138035c958b54e11a1 (patch) | |
tree | 4f25fca9bf82e3a4ffa252067e8ce7f51c1b49b8 /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | 851a5efe45a026047ba8c0262a892b9895e355bf (diff) | |
download | llvm-79e77a9f39f02a18e839f8138035c958b54e11a1.zip llvm-79e77a9f39f02a18e839f8138035c958b54e11a1.tar.gz llvm-79e77a9f39f02a18e839f8138035c958b54e11a1.tar.bz2 |
[AMDGPU] Flush the vmcnt counter in loop preheaders when necessary
waitcnt vmcnt instructions are currently generated in loop bodies before using
values loaded outside of the loop. In some cases, it is better to flush the
vmcnt counter in a loop preheader before entering the loop body. This patch
detects these cases and generates waitcnt instructions to flush the counter.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D115747
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 26e8410..c186d0b 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -915,6 +915,10 @@ bool MachineBasicBlock::isLayoutSuccessor(const MachineBasicBlock *MBB) const { return std::next(I) == MachineFunction::const_iterator(MBB); } +const MachineBasicBlock *MachineBasicBlock::getSingleSuccessor() const { + return Successors.size() == 1 ? Successors[0] : nullptr; +} + MachineBasicBlock *MachineBasicBlock::getFallThrough() { MachineFunction::iterator Fallthrough = getIterator(); ++Fallthrough; |