@@ -479,34 +479,35 @@ inline KnownFPClass operator|(const KnownFPClass &LHS, KnownFPClass &&RHS) {
479479// / point classes should be queried. Queries not specified in \p
480480// / InterestedClasses should be reliable if they are determined during the
481481// / query.
482- KnownFPClass computeKnownFPClass (
483- const Value *V, const APInt &DemandedElts, const DataLayout &DL,
484- FPClassTest InterestedClasses = fcAllFlags, unsigned Depth = 0 ,
485- const TargetLibraryInfo *TLI = nullptr , AssumptionCache *AC = nullptr ,
486- const Instruction *CxtI = nullptr , const DominatorTree *DT = nullptr ,
487- bool UseInstrInfo = true );
482+ KnownFPClass computeKnownFPClass (const Value *V, const APInt &DemandedElts,
483+ FPClassTest InterestedClasses, unsigned Depth,
484+ const SimplifyQuery &SQ);
488485
489- KnownFPClass computeKnownFPClass (
490- const Value *V, const DataLayout &DL,
491- FPClassTest InterestedClasses = fcAllFlags, unsigned Depth = 0 ,
492- const TargetLibraryInfo *TLI = nullptr , AssumptionCache *AC = nullptr ,
493- const Instruction *CxtI = nullptr , const DominatorTree *DT = nullptr ,
494- bool UseInstrInfo = true );
486+ KnownFPClass computeKnownFPClass (const Value *V, FPClassTest InterestedClasses,
487+ unsigned Depth, const SimplifyQuery &SQ);
495488
496- // / Wrapper to account for known fast math flags at the use instruction.
497489inline KnownFPClass computeKnownFPClass (
498- const Value *V, FastMathFlags FMF, const DataLayout &DL,
490+ const Value *V, const DataLayout &DL,
499491 FPClassTest InterestedClasses = fcAllFlags, unsigned Depth = 0 ,
500492 const TargetLibraryInfo *TLI = nullptr , AssumptionCache *AC = nullptr ,
501493 const Instruction *CxtI = nullptr , const DominatorTree *DT = nullptr ,
502494 bool UseInstrInfo = true ) {
495+ return computeKnownFPClass (
496+ V, InterestedClasses, Depth,
497+ SimplifyQuery (DL, TLI, DT, AC, CxtI, UseInstrInfo));
498+ }
499+
500+ // / Wrapper to account for known fast math flags at the use instruction.
501+ inline KnownFPClass computeKnownFPClass (const Value *V, FastMathFlags FMF,
502+ FPClassTest InterestedClasses,
503+ unsigned Depth,
504+ const SimplifyQuery &SQ) {
503505 if (FMF.noNaNs ())
504506 InterestedClasses &= ~fcNan;
505507 if (FMF.noInfs ())
506508 InterestedClasses &= ~fcInf;
507509
508- KnownFPClass Result = computeKnownFPClass (V, DL, InterestedClasses, Depth,
509- TLI, AC, CxtI, DT, UseInstrInfo);
510+ KnownFPClass Result = computeKnownFPClass (V, InterestedClasses, Depth, SQ);
510511
511512 if (FMF.noNaNs ())
512513 Result.KnownFPClasses &= ~fcNan;
@@ -518,15 +519,9 @@ inline KnownFPClass computeKnownFPClass(
518519// / Return true if we can prove that the specified FP value is never equal to
519520// / -0.0. Users should use caution when considering PreserveSign
520521// / denormal-fp-math.
521- inline bool cannotBeNegativeZero (const Value *V, const DataLayout &DL,
522- const TargetLibraryInfo *TLI = nullptr ,
523- unsigned Depth = 0 ,
524- AssumptionCache *AC = nullptr ,
525- const Instruction *CtxI = nullptr ,
526- const DominatorTree *DT = nullptr ,
527- bool UseInstrInfo = true ) {
528- KnownFPClass Known = computeKnownFPClass (V, DL, fcNegZero, Depth, TLI, AC,
529- CtxI, DT, UseInstrInfo);
522+ inline bool cannotBeNegativeZero (const Value *V, unsigned Depth,
523+ const SimplifyQuery &SQ) {
524+ KnownFPClass Known = computeKnownFPClass (V, fcNegZero, Depth, SQ);
530525 return Known.isKnownNeverNegZero ();
531526}
532527
@@ -538,69 +533,44 @@ inline bool cannotBeNegativeZero(const Value *V, const DataLayout &DL,
538533// / -0 --> true
539534// / x > +0 --> true
540535// / x < -0 --> false
541- inline bool cannotBeOrderedLessThanZero (const Value *V, const DataLayout &DL,
542- const TargetLibraryInfo *TLI = nullptr ,
543- unsigned Depth = 0 ,
544- AssumptionCache *AC = nullptr ,
545- const Instruction *CtxI = nullptr ,
546- const DominatorTree *DT = nullptr ,
547- bool UseInstrInfo = true ) {
536+ inline bool cannotBeOrderedLessThanZero (const Value *V, unsigned Depth,
537+ const SimplifyQuery &SQ) {
548538 KnownFPClass Known =
549- computeKnownFPClass (V, DL, KnownFPClass::OrderedLessThanZeroMask, Depth,
550- TLI, AC, CtxI, DT, UseInstrInfo);
539+ computeKnownFPClass (V, KnownFPClass::OrderedLessThanZeroMask, Depth, SQ);
551540 return Known.cannotBeOrderedLessThanZero ();
552541}
553542
554543// / Return true if the floating-point scalar value is not an infinity or if
555544// / the floating-point vector value has no infinities. Return false if a value
556545// / could ever be infinity.
557- inline bool isKnownNeverInfinity (const Value *V, const DataLayout &DL,
558- const TargetLibraryInfo *TLI = nullptr ,
559- unsigned Depth = 0 ,
560- AssumptionCache *AC = nullptr ,
561- const Instruction *CtxI = nullptr ,
562- const DominatorTree *DT = nullptr ,
563- bool UseInstrInfo = true ) {
564- KnownFPClass Known = computeKnownFPClass (V, DL, fcInf, Depth, TLI, AC, CtxI,
565- DT, UseInstrInfo);
546+ inline bool isKnownNeverInfinity (const Value *V, unsigned Depth,
547+ const SimplifyQuery &SQ) {
548+ KnownFPClass Known = computeKnownFPClass (V, fcInf, Depth, SQ);
566549 return Known.isKnownNeverInfinity ();
567550}
568551
569552// / Return true if the floating-point value can never contain a NaN or infinity.
570- inline bool isKnownNeverInfOrNaN (
571- const Value *V, const DataLayout &DL, const TargetLibraryInfo *TLI,
572- unsigned Depth = 0 , AssumptionCache *AC = nullptr ,
573- const Instruction *CtxI = nullptr , const DominatorTree *DT = nullptr ,
574- bool UseInstrInfo = true ) {
575- KnownFPClass Known = computeKnownFPClass (V, DL, fcInf | fcNan, Depth, TLI, AC,
576- CtxI, DT, UseInstrInfo);
553+ inline bool isKnownNeverInfOrNaN (const Value *V, unsigned Depth,
554+ const SimplifyQuery &SQ) {
555+ KnownFPClass Known = computeKnownFPClass (V, fcInf | fcNan, Depth, SQ);
577556 return Known.isKnownNeverNaN () && Known.isKnownNeverInfinity ();
578557}
579558
580559// / Return true if the floating-point scalar value is not a NaN or if the
581560// / floating-point vector value has no NaN elements. Return false if a value
582561// / could ever be NaN.
583- inline bool isKnownNeverNaN (const Value *V, const DataLayout &DL,
584- const TargetLibraryInfo *TLI, unsigned Depth = 0 ,
585- AssumptionCache *AC = nullptr ,
586- const Instruction *CtxI = nullptr ,
587- const DominatorTree *DT = nullptr ,
588- bool UseInstrInfo = true ) {
589- KnownFPClass Known = computeKnownFPClass (V, DL, fcNan, Depth, TLI, AC, CtxI,
590- DT, UseInstrInfo);
562+ inline bool isKnownNeverNaN (const Value *V, unsigned Depth,
563+ const SimplifyQuery &SQ) {
564+ KnownFPClass Known = computeKnownFPClass (V, fcNan, Depth, SQ);
591565 return Known.isKnownNeverNaN ();
592566}
593567
594568// / Return false if we can prove that the specified FP value's sign bit is 0.
595569// / Return true if we can prove that the specified FP value's sign bit is 1.
596570// / Otherwise return std::nullopt.
597- inline std::optional<bool > computeKnownFPSignBit (
598- const Value *V, const DataLayout &DL,
599- const TargetLibraryInfo *TLI = nullptr , unsigned Depth = 0 ,
600- AssumptionCache *AC = nullptr , const Instruction *CtxI = nullptr ,
601- const DominatorTree *DT = nullptr , bool UseInstrInfo = true ) {
602- KnownFPClass Known = computeKnownFPClass (V, DL, fcAllFlags, Depth, TLI, AC,
603- CtxI, DT, UseInstrInfo);
571+ inline std::optional<bool > computeKnownFPSignBit (const Value *V, unsigned Depth,
572+ const SimplifyQuery &SQ) {
573+ KnownFPClass Known = computeKnownFPClass (V, fcAllFlags, Depth, SQ);
604574 return Known.SignBit ;
605575}
606576
0 commit comments