Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 4,912 Lines • ▼ Show 20 Lines | bool SelectionDAG::isKnownNeverNaN(SDValue Op, bool SNaN, unsigned Depth) const { | ||||
} | } | ||||
} | } | ||||
bool SelectionDAG::isKnownNeverZeroFloat(SDValue Op) const { | bool SelectionDAG::isKnownNeverZeroFloat(SDValue Op) const { | ||||
assert(Op.getValueType().isFloatingPoint() && | assert(Op.getValueType().isFloatingPoint() && | ||||
"Floating point type expected"); | "Floating point type expected"); | ||||
// If the value is a constant, we can obviously see if it is a zero or not. | // If the value is a constant, we can obviously see if it is a zero or not. | ||||
// TODO: Add BuildVector support. | |||||
if (const ConstantFPSDNode *C = dyn_cast<ConstantFPSDNode>(Op)) | if (const ConstantFPSDNode *C = dyn_cast<ConstantFPSDNode>(Op)) | ||||
return !C->isZero(); | return !C->isZero(); | ||||
// Return false if we find any zero in a vector. | |||||
if (Op->getOpcode() == ISD::BUILD_VECTOR || | |||||
Op->getOpcode() == ISD::SPLAT_VECTOR) { | |||||
for (const SDValue &OpVal : Op->op_values()) { | |||||
if (OpVal.isUndef()) | |||||
return false; | |||||
if (auto *C = dyn_cast<ConstantFPSDNode>(OpVal)) | |||||
if (C->isZero()) | |||||
return false; | |||||
} | |||||
return true; | |||||
} | |||||
return false; | return false; | ||||
} | } | ||||
bool SelectionDAG::isKnownNeverZero(SDValue Op) const { | bool SelectionDAG::isKnownNeverZero(SDValue Op) const { | ||||
assert(!Op.getValueType().isFloatingPoint() && | assert(!Op.getValueType().isFloatingPoint() && | ||||
"Floating point types unsupported - use isKnownNeverZeroFloat"); | "Floating point types unsupported - use isKnownNeverZeroFloat"); | ||||
// If the value is a constant, we can obviously see if it is a zero or not. | // If the value is a constant, we can obviously see if it is a zero or not. | ||||
▲ Show 20 Lines • Show All 7,283 Lines • Show Last 20 Lines |