forked from OSchip/llvm-project
In InstCombine{AddSub,MulDivRem} convert APFloat.isFiniteNonZero() && !APFloat.isDenormal => APFloat.isNormal.
llvm-svn: 185037
This commit is contained in:
parent
8136c384c5
commit
c2af8d6273
|
@ -488,7 +488,7 @@ Value *FAddCombine::performFactorization(Instruction *I) {
|
|||
createFSub(AddSub0, AddSub1);
|
||||
if (ConstantFP *CFP = dyn_cast<ConstantFP>(NewAddSub)) {
|
||||
const APFloat &F = CFP->getValueAPF();
|
||||
if (!F.isFiniteNonZero() || F.isDenormal())
|
||||
if (!F.isNormal())
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -344,7 +344,7 @@ static bool isFMulOrFDivWithConstant(Value *V) {
|
|||
|
||||
static bool isNormalFp(const ConstantFP *C) {
|
||||
const APFloat &Flt = C->getValueAPF();
|
||||
return Flt.isFiniteNonZero() && !Flt.isDenormal();
|
||||
return Flt.isNormal();
|
||||
}
|
||||
|
||||
/// foldFMulConst() is a helper routine of InstCombiner::visitFMul().
|
||||
|
@ -893,14 +893,14 @@ Instruction *InstCombiner::visitFDiv(BinaryOperator &I) {
|
|||
//
|
||||
Constant *C = ConstantExpr::getFDiv(C1, C2);
|
||||
const APFloat &F = cast<ConstantFP>(C)->getValueAPF();
|
||||
if (F.isFiniteNonZero() && !F.isDenormal())
|
||||
if (F.isNormal())
|
||||
Res = BinaryOperator::CreateFMul(X, C);
|
||||
} else if (match(Op0, m_FDiv(m_Value(X), m_ConstantFP(C1)))) {
|
||||
// (X/C1)/C2 => X /(C2*C1) [=> X * 1/(C2*C1) if reciprocal is allowed]
|
||||
//
|
||||
Constant *C = ConstantExpr::getFMul(C1, C2);
|
||||
const APFloat &F = cast<ConstantFP>(C)->getValueAPF();
|
||||
if (F.isFiniteNonZero() && !F.isDenormal()) {
|
||||
if (F.isNormal()) {
|
||||
Res = CvtFDivConstToReciprocal(X, cast<ConstantFP>(C),
|
||||
AllowReciprocal);
|
||||
if (!Res)
|
||||
|
@ -941,7 +941,7 @@ Instruction *InstCombiner::visitFDiv(BinaryOperator &I) {
|
|||
|
||||
if (Fold) {
|
||||
const APFloat &FoldC = cast<ConstantFP>(Fold)->getValueAPF();
|
||||
if (FoldC.isFiniteNonZero() && !FoldC.isDenormal()) {
|
||||
if (FoldC.isNormal()) {
|
||||
Instruction *R = CreateDiv ?
|
||||
BinaryOperator::CreateFDiv(Fold, X) :
|
||||
BinaryOperator::CreateFMul(X, Fold);
|
||||
|
|
Loading…
Reference in New Issue