ConstantFPSDNode *isConstOrConstSplatFP(SDValue N, bool AllowUndefs = false);
/// Return true if the value is a constant 0 integer or a splatted vector of
-/// a constant 0 integer (with no undefs).
+/// a constant 0 integer (with no undefs by default).
/// Build vector implicit truncation is not an issue for null values.
-bool isNullOrNullSplat(SDValue V);
+bool isNullOrNullSplat(SDValue V, bool AllowUndefs = false);
/// Return true if the value is a constant 1 integer or a splatted vector of a
/// constant 1 integer (with no undefs).
return IsFSHL ? N0 : N1;
auto IsUndefOrZero = [](SDValue V) {
- if (V.isUndef())
- return true;
- if (ConstantSDNode *Cst = isConstOrConstSplat(V, /*AllowUndefs*/true))
- return Cst->getAPIntValue() == 0;
- return false;
+ return V.isUndef() || isNullOrNullSplat(V, /*AllowUndefs*/ true);
};
if (ConstantSDNode *Cst = isConstOrConstSplat(N2)) {
return nullptr;
}
-bool llvm::isNullOrNullSplat(SDValue N) {
+bool llvm::isNullOrNullSplat(SDValue N, bool AllowUndefs) {
// TODO: may want to use peekThroughBitcast() here.
- ConstantSDNode *C = isConstOrConstSplat(N);
+ ConstantSDNode *C = isConstOrConstSplat(N, AllowUndefs);
return C && C->isNullValue();
}