Skip to content

Commit d4396d4

Browse files
Only proceed with the optiization if ballot arg is an instruction
1 parent 4d04255 commit d4396d4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,10 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
13491349
// assume(ballot(x) == -1) -> x = true
13501350
// assume(ballot(x) == 0) -> x = false
13511351
//
1352+
// Skip if Arg is not an instruction (e.g., constant, argument).
1353+
if (!isa<Instruction>(Arg))
1354+
break;
1355+
13521356
// Skip if ballot width < wave size (e.g., ballot.i32 on wave64).
13531357
if (ST->isWave64() && II.getType()->getIntegerBitWidth() == 32)
13541358
break; // ballot.i32 on wave64 captures only lanes [0:31]

0 commit comments

Comments
 (0)