[llvm] [AMDGPU] Change control flow intrinsic lowering making the wave to re… (PR #86805)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 19 13:40:30 PDT 2024
================
@@ -15619,6 +15619,91 @@ void SITargetLowering::finalizeLowering(MachineFunction &MF) const {
}
}
+ // ISel inserts copy to regs for the successor PHIs
+ // at the BB end. We need to move the SI_WAVE_RECONVERGE right before the branch.
+ // Even we don't have to move SI_WAVE_RECONVERGE we need to take care of the
+ // S_CBRANCH_SCC0/1 as SI_WAVE_RECONVERGE overwrites SCC
+ for (auto &MBB : MF) {
+ for (auto &MI : MBB) {
+ if (MI.getOpcode() == AMDGPU::SI_WAVE_RECONVERGE) {
+ MachineBasicBlock::iterator I(MI);
+ MachineBasicBlock::iterator Next = std::next(I);
+ bool NeedToMove = false;
+ while (Next != MBB.end() && !Next->isBranch()) {
+ NeedToMove = true;
+ Next++;
+ }
+
+ // Lets take care of SCC users as SI_WAVE_RECONVERGE defines SCC
+ bool NeedPreserveSCC =
+ Next != MBB.end() && Next->readsRegister(AMDGPU::SCC);
----------------
alex-t wrote:
Done
https://github.com/llvm/llvm-project/pull/86805
More information about the llvm-commits
mailing list