Revert "[AMDGPU] Fix llvm.amdgcn.ballot with return width != wavefront size" (#212628)

Reverts llvm/llvm-project#211493

unblock bot: https://lab.llvm.org/buildbot/#/builders/232
This commit is contained in:
Kewen Meng 2026-07-28 15:30:31 -07:00 committed by GitHub
parent 9f761055cf
commit c6f775c5fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 2 additions and 33 deletions

View file

@ -1729,15 +1729,8 @@ bool AMDGPUInstructionSelector::selectBallot(MachineInstr &I) const {
const unsigned BallotSize = MRI->getType(DstReg).getSizeInBits();
const unsigned WaveSize = STI.getWavefrontSize();
if (BallotSize < WaveSize) {
const Function &Fn = MF->getFunction();
Fn.getContext().diagnose(DiagnosticInfoUnsupported(
Fn, "ballot return type is narrower than the wavefront size", DL));
BuildMI(*BB, &I, DL, TII.get(AMDGPU::IMPLICIT_DEF), DstReg);
I.eraseFromParent();
return true;
}
// In the common case, the return type matches the wave size.
// However we also support emitting i64 ballots in wave32 mode.
if (BallotSize != WaveSize && (BallotSize != 64 || WaveSize != 32))
return false;

View file

@ -7942,15 +7942,6 @@ static SDValue lowerBALLOTIntrinsic(const SITargetLowering &TLI, SDNode *N,
SDValue Src = N->getOperand(1);
SDLoc SL(N);
unsigned WavefrontSize = TLI.getSubtarget()->getWavefrontSize();
if (VT.getScalarSizeInBits() < WavefrontSize) {
DAG.getContext()->diagnose(DiagnosticInfoUnsupported(
DAG.getMachineFunction().getFunction(),
"ballot return type is narrower than the wavefront size",
SL.getDebugLoc()));
return DAG.getPOISON(VT);
}
if (Src.getOpcode() == ISD::SETCC) {
SDValue Op0 = Src.getOperand(0);
SDValue Op1 = Src.getOperand(1);

View file

@ -1,15 +0,0 @@
; RUN: not llc -global-isel=0 -mtriple=amdgpu9.00 -filetype=null %s 2>&1 | FileCheck %s
; RUN: not llc -global-isel=1 -mtriple=amdgpu9.00 -filetype=null %s 2>&1 | FileCheck %s
; An i32 ballot on a wave64 target cannot represent one bit per lane, so
; both SelectionDAG and GlobalISel must refuse to lower it instead of
; dropping the mask bits of the high lanes.
declare i32 @llvm.amdgcn.ballot.i32(i1)
; CHECK: error: {{.*}}ballot return type is narrower than the wavefront size
define amdgpu_cs i32 @ballot_i32_wave64(i32 %x, i32 %y) {
%cmp = icmp eq i32 %x, %y
%ballot = call i32 @llvm.amdgcn.ballot.i32(i1 %cmp)
ret i32 %ballot
}