[llvm] AMDGPU/GlobalISel: Fix inst-selection of ballot (PR #109986)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 25 08:04:19 PDT 2024
================
@@ -1429,34 +1429,57 @@ bool AMDGPUInstructionSelector::selectBallot(MachineInstr &I) const {
std::optional<ValueAndVReg> Arg =
getIConstantVRegValWithLookThrough(I.getOperand(2).getReg(), *MRI);
- const auto BuildCopy = [&](Register SrcReg) {
- if (Size == STI.getWavefrontSize()) {
- BuildMI(*BB, &I, DL, TII.get(AMDGPU::COPY), DstReg)
- .addReg(SrcReg);
- return;
- }
+ const auto BuildAnd = [&](unsigned Opcode, Register Dst, Register Src,
+ Register Exec) {
+ auto And = BuildMI(*BB, &I, DL, TII.get(Opcode), Dst)
+ .addReg(Src)
+ .addReg(Exec)
+ .setOperandDead(3); // Dead scc
+ constrainSelectedInstRegOperands(*And, TII, TRI, RBI);
----------------
arsenm wrote:
Should check return value
https://github.com/llvm/llvm-project/pull/109986
More information about the llvm-commits
mailing list