diff options
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AMDGPUGlobalISelDivergenceLowering.cpp')
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUGlobalISelDivergenceLowering.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUGlobalISelDivergenceLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUGlobalISelDivergenceLowering.cpp index 4f65a95..a0c6bf7 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUGlobalISelDivergenceLowering.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUGlobalISelDivergenceLowering.cpp @@ -177,7 +177,16 @@ void DivergenceLoweringHelper::buildMergeLaneMasks( B.buildInstr(OrOp, {DstReg}, {PrevMaskedReg, CurMaskedReg}); } -void DivergenceLoweringHelper::constrainAsLaneMask(Incoming &In) { return; } +// GlobalISel has to constrain S1 incoming taken as-is with lane mask register +// class. Insert a copy of Incoming.Reg to new lane mask inside Incoming.Block, +// Incoming.Reg becomes that new lane mask. +void DivergenceLoweringHelper::constrainAsLaneMask(Incoming &In) { + B.setInsertPt(*In.Block, In.Block->getFirstTerminator()); + + auto Copy = B.buildCopy(LLT::scalar(1), In.Reg); + MRI->setRegClass(Copy.getReg(0), ST->getBoolRC()); + In.Reg = Copy.getReg(0); +} } // End anonymous namespace. |