Skip to content

Commit 346f16d

Browse files
committed
[DAG] Move isNullConstantOrUndef helper to SelectionDAGNodes.h to allow other future uses. NFC.
1 parent b1484f7 commit 346f16d

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

llvm/include/llvm/CodeGen/SelectionDAGNodes.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,6 +1754,9 @@ class ConstantFPSDNode : public SDNode {
17541754
/// Returns true if \p V is a constant integer zero.
17551755
bool isNullConstant(SDValue V);
17561756

1757+
/// Returns true if \p V is a constant integer zero or an UNDEF node.
1758+
bool isNullConstantOrUndef(SDValue V);
1759+
17571760
/// Returns true if \p V is an FP constant with a value of positive zero.
17581761
bool isNullFPConstant(SDValue V);
17591762

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11753,6 +11753,10 @@ bool llvm::isNullConstant(SDValue V) {
1175311753
return Const != nullptr && Const->isZero();
1175411754
}
1175511755

11756+
bool llvm::isNullConstantOrUndef(SDValue V) {
11757+
return V.isUndef() || isNullConstant(V);
11758+
}
11759+
1175611760
bool llvm::isNullFPConstant(SDValue V) {
1175711761
ConstantFPSDNode *Const = dyn_cast<ConstantFPSDNode>(V);
1175811762
return Const != nullptr && Const->isZero() && !Const->isNegative();

llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ using namespace llvm;
2424

2525
namespace {
2626

27-
static inline bool isNullConstantOrUndef(SDValue V) {
28-
return V.isUndef() || isNullConstant(V);
29-
}
30-
3127
static inline bool getConstantValue(SDValue N, uint32_t &Out) {
3228
// This is only used for packed vectors, where using 0 for undef should
3329
// always be good.

0 commit comments

Comments
 (0)