diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-07-07 18:17:14 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-07-07 18:17:14 +0000 |
commit | 23f9eddabe8f76164890afa3979d3c9d343b3612 (patch) | |
tree | e8675630f3433a61dad45c94eed376bb51174a37 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | 0a36daa5a26bbea217898ae65afc4d3d046da50c (diff) | |
download | bcm5719-llvm-23f9eddabe8f76164890afa3979d3c9d343b3612.tar.gz bcm5719-llvm-23f9eddabe8f76164890afa3979d3c9d343b3612.zip |
[SelectionDAG] Split float and integer isKnownNeverZero tests
Splits off isKnownNeverZeroFloat to handle +/- 0 float cases.
This will make it easier to be more aggressive with the integer isKnownNeverZero tests (similar to ValueTracking), use computeKnownBits etc.
Differential Revision: https://reviews.llvm.org/D48969
llvm-svn: 336492
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 20c0c35332e..1abc8c99efd 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -3611,10 +3611,20 @@ bool SelectionDAG::isKnownNeverNaN(SDValue Op) const { return false; } -bool SelectionDAG::isKnownNeverZero(SDValue Op) const { +bool SelectionDAG::isKnownNeverZeroFloat(SDValue Op) const { + assert(Op.getValueType().isFloatingPoint() && + "Floating point type expected"); + // 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)) return !C->isZero(); + return false; +} + +bool SelectionDAG::isKnownNeverZero(SDValue Op) const { + assert(!Op.getValueType().isFloatingPoint() && + "Floating point types unsupported - use isKnownNeverZeroFloat"); // TODO: Recognize more cases here. switch (Op.getOpcode()) { |