diff options
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 923ff04..dc3c90b 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -4181,8 +4181,14 @@ llvm::fcmpToClassTest(FCmpInst::Predicate Pred, const Function &F, Value *LHS, } case FCmpInst::FCMP_OGE: case FCmpInst::FCMP_ULT: { - if (ConstRHS->isNegative()) // TODO - return {nullptr, fcAllFlags}; + if (ConstRHS->isNegative()) { + // fcmp oge x, -inf -> ~fcNan + // fcmp oge fabs(x), -inf -> ~fcNan + // fcmp ult x, -inf -> fcNan + // fcmp ult fabs(x), -inf -> fcNan + Mask = ~fcNan; + break; + } // fcmp oge fabs(x), +inf -> fcInf // fcmp oge x, +inf -> fcPosInf @@ -4195,8 +4201,14 @@ llvm::fcmpToClassTest(FCmpInst::Predicate Pred, const Function &F, Value *LHS, } case FCmpInst::FCMP_OGT: case FCmpInst::FCMP_ULE: { - if (ConstRHS->isNegative()) - return {nullptr, fcAllFlags}; + if (ConstRHS->isNegative()) { + // fcmp ogt x, -inf -> fcmp one x, -inf + // fcmp ogt fabs(x), -inf -> fcmp ord x, x + // fcmp ule x, -inf -> fcmp ueq x, -inf + // fcmp ule fabs(x), -inf -> fcmp uno x, x + Mask = IsFabs ? ~fcNan : ~(fcNegInf | fcNan); + break; + } // No value is ordered and greater than infinity. Mask = fcNone; |