aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2023-12-07 22:33:46 -0800
committerKazu Hirata <kazu@google.com>2023-12-07 22:33:46 -0800
commit28a78e2a4a2c358900aaac1a1eb9efce17a7f5a5 (patch)
tree26892793d327b2470b454df3e1785a4aff9bb5ef
parentc8616c724fbddd38117240585242f4ae4db1ff3a (diff)
downloadllvm-28a78e2a4a2c358900aaac1a1eb9efce17a7f5a5.zip
llvm-28a78e2a4a2c358900aaac1a1eb9efce17a7f5a5.tar.gz
llvm-28a78e2a4a2c358900aaac1a1eb9efce17a7f5a5.tar.bz2
[AMDGPU] Use isNullConstant (NFC)
-rw-r--r--llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
index fb8d685..a6d1da9 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
@@ -2334,9 +2334,8 @@ static SDValue combineBallotPattern(SDValue VCMP, bool &Negate) {
// Note that ballot doesn't use SETEQ condition but its easy to support it
// here for completeness, so in this case Negate is set true on return.
auto VCMP_CC = cast<CondCodeSDNode>(VCMP.getOperand(2))->get();
- auto *VCMP_CRHS = dyn_cast<ConstantSDNode>(VCMP.getOperand(1));
- if ((VCMP_CC == ISD::SETEQ || VCMP_CC == ISD::SETNE) && VCMP_CRHS &&
- VCMP_CRHS->isZero()) {
+ if ((VCMP_CC == ISD::SETEQ || VCMP_CC == ISD::SETNE) &&
+ isNullConstant(VCMP.getOperand(1))) {
auto Cond = VCMP.getOperand(0);
if (ISD::isExtOpcode(Cond->getOpcode())) // Skip extension.
@@ -2370,8 +2369,8 @@ void AMDGPUDAGToDAGISel::SelectBRCOND(SDNode *N) {
Cond->getOperand(0)->getOpcode() == AMDGPUISD::SETCC) {
SDValue VCMP = Cond->getOperand(0);
auto CC = cast<CondCodeSDNode>(Cond->getOperand(2))->get();
- auto *CRHS = dyn_cast<ConstantSDNode>(Cond->getOperand(1));
- if ((CC == ISD::SETEQ || CC == ISD::SETNE) && CRHS && CRHS->isZero() &&
+ if ((CC == ISD::SETEQ || CC == ISD::SETNE) &&
+ isNullConstant(Cond->getOperand(1)) &&
// TODO: make condition below an assert after fixing ballot bitwidth.
VCMP.getValueType().getSizeInBits() == ST->getWavefrontSize()) {
// %VCMP = i(WaveSize) AMDGPUISD::SETCC ...