diff options
author | Sanjay Patel <spatel@rotateright.com> | 2019-04-30 14:37:15 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2019-04-30 14:37:15 +0000 |
commit | 0387bf5269114d2607dda6a53e370d0a3d5e7103 (patch) | |
tree | 92ba34ff5e69e99153527e4e0c00415e0ee880b1 /llvm/lib/CodeGen | |
parent | 24896d304df91f0093f033acd53c95120b18f5ac (diff) | |
download | bcm5719-llvm-0387bf5269114d2607dda6a53e370d0a3d5e7103.tar.gz bcm5719-llvm-0387bf5269114d2607dda6a53e370d0a3d5e7103.zip |
[SelectionDAG] remove div-by-zero constant folding restriction
We don't have this restriction in IR, so it should not be here
either simply out of consistency. Code that wants to handle FP
exceptions is expected to use the 'strict' variants of these
nodes.
We don't get the frem case because frem by 0.0 produces NaN (invalid),
and that's the remaining check here (so the removed check for frem
was dead code AFAIK).
This is the only place in SDAG that uses "HasFPExceptions", so I
think we should remove that entirely as a follow-up patch.
llvm-svn: 359566
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index f17fee2fe74..e85695755d4 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -4816,17 +4816,13 @@ SDValue SelectionDAG::foldConstantFPMath(unsigned Opcode, const SDLoc &DL, break; case ISD::FDIV: Status = C1.divide(C2, APFloat::rmNearestTiesToEven); - if (!HasFPExceptions || (Status != APFloat::opInvalidOp && - Status != APFloat::opDivByZero)) { + if (!HasFPExceptions || Status != APFloat::opInvalidOp) return getConstantFP(C1, DL, VT); - } break; case ISD::FREM: Status = C1.mod(C2); - if (!HasFPExceptions || (Status != APFloat::opInvalidOp && - Status != APFloat::opDivByZero)) { + if (!HasFPExceptions || Status != APFloat::opInvalidOp) return getConstantFP(C1, DL, VT); - } break; case ISD::FCOPYSIGN: C1.copySign(C2); @@ -4840,7 +4836,7 @@ SDValue SelectionDAG::foldConstantFPMath(unsigned Opcode, const SDLoc &DL, // This can return overflow, underflow, or inexact; we don't care. // FIXME need to be more flexible about rounding mode. (void) C1.convert(EVTToAPFloatSemantics(VT), APFloat::rmNearestTiesToEven, - &Unused); + &Unused); return getConstantFP(C1, DL, VT); } |