Skip to content

Commit 28a78e2

Browse files
[AMDGPU] Use isNullConstant (NFC)
1 parent c8616c7 commit 28a78e2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,9 +2334,8 @@ static SDValue combineBallotPattern(SDValue VCMP, bool &Negate) {
23342334
// Note that ballot doesn't use SETEQ condition but its easy to support it
23352335
// here for completeness, so in this case Negate is set true on return.
23362336
auto VCMP_CC = cast<CondCodeSDNode>(VCMP.getOperand(2))->get();
2337-
auto *VCMP_CRHS = dyn_cast<ConstantSDNode>(VCMP.getOperand(1));
2338-
if ((VCMP_CC == ISD::SETEQ || VCMP_CC == ISD::SETNE) && VCMP_CRHS &&
2339-
VCMP_CRHS->isZero()) {
2337+
if ((VCMP_CC == ISD::SETEQ || VCMP_CC == ISD::SETNE) &&
2338+
isNullConstant(VCMP.getOperand(1))) {
23402339

23412340
auto Cond = VCMP.getOperand(0);
23422341
if (ISD::isExtOpcode(Cond->getOpcode())) // Skip extension.
@@ -2370,8 +2369,8 @@ void AMDGPUDAGToDAGISel::SelectBRCOND(SDNode *N) {
23702369
Cond->getOperand(0)->getOpcode() == AMDGPUISD::SETCC) {
23712370
SDValue VCMP = Cond->getOperand(0);
23722371
auto CC = cast<CondCodeSDNode>(Cond->getOperand(2))->get();
2373-
auto *CRHS = dyn_cast<ConstantSDNode>(Cond->getOperand(1));
2374-
if ((CC == ISD::SETEQ || CC == ISD::SETNE) && CRHS && CRHS->isZero() &&
2372+
if ((CC == ISD::SETEQ || CC == ISD::SETNE) &&
2373+
isNullConstant(Cond->getOperand(1)) &&
23752374
// TODO: make condition below an assert after fixing ballot bitwidth.
23762375
VCMP.getValueType().getSizeInBits() == ST->getWavefrontSize()) {
23772376
// %VCMP = i(WaveSize) AMDGPUISD::SETCC ...

0 commit comments

Comments
 (0)