@@ -479,34 +479,35 @@ inline KnownFPClass operator|(const KnownFPClass &LHS, KnownFPClass &&RHS) {
479
479
// / point classes should be queried. Queries not specified in \p
480
480
// / InterestedClasses should be reliable if they are determined during the
481
481
// / 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);
488
485
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);
495
488
496
- // / Wrapper to account for known fast math flags at the use instruction.
497
489
inline KnownFPClass computeKnownFPClass (
498
- const Value *V, FastMathFlags FMF, const DataLayout &DL,
490
+ const Value *V, const DataLayout &DL,
499
491
FPClassTest InterestedClasses = fcAllFlags, unsigned Depth = 0 ,
500
492
const TargetLibraryInfo *TLI = nullptr , AssumptionCache *AC = nullptr ,
501
493
const Instruction *CxtI = nullptr , const DominatorTree *DT = nullptr ,
502
494
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) {
503
505
if (FMF.noNaNs ())
504
506
InterestedClasses &= ~fcNan;
505
507
if (FMF.noInfs ())
506
508
InterestedClasses &= ~fcInf;
507
509
508
- KnownFPClass Result = computeKnownFPClass (V, DL, InterestedClasses, Depth,
509
- TLI, AC, CxtI, DT, UseInstrInfo);
510
+ KnownFPClass Result = computeKnownFPClass (V, InterestedClasses, Depth, SQ);
510
511
511
512
if (FMF.noNaNs ())
512
513
Result.KnownFPClasses &= ~fcNan;
@@ -518,15 +519,9 @@ inline KnownFPClass computeKnownFPClass(
518
519
// / Return true if we can prove that the specified FP value is never equal to
519
520
// / -0.0. Users should use caution when considering PreserveSign
520
521
// / 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);
530
525
return Known.isKnownNeverNegZero ();
531
526
}
532
527
@@ -538,69 +533,44 @@ inline bool cannotBeNegativeZero(const Value *V, const DataLayout &DL,
538
533
// / -0 --> true
539
534
// / x > +0 --> true
540
535
// / 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) {
548
538
KnownFPClass Known =
549
- computeKnownFPClass (V, DL, KnownFPClass::OrderedLessThanZeroMask, Depth,
550
- TLI, AC, CtxI, DT, UseInstrInfo);
539
+ computeKnownFPClass (V, KnownFPClass::OrderedLessThanZeroMask, Depth, SQ);
551
540
return Known.cannotBeOrderedLessThanZero ();
552
541
}
553
542
554
543
// / Return true if the floating-point scalar value is not an infinity or if
555
544
// / the floating-point vector value has no infinities. Return false if a value
556
545
// / 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);
566
549
return Known.isKnownNeverInfinity ();
567
550
}
568
551
569
552
// / 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);
577
556
return Known.isKnownNeverNaN () && Known.isKnownNeverInfinity ();
578
557
}
579
558
580
559
// / Return true if the floating-point scalar value is not a NaN or if the
581
560
// / floating-point vector value has no NaN elements. Return false if a value
582
561
// / 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);
591
565
return Known.isKnownNeverNaN ();
592
566
}
593
567
594
568
// / Return false if we can prove that the specified FP value's sign bit is 0.
595
569
// / Return true if we can prove that the specified FP value's sign bit is 1.
596
570
// / 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);
604
574
return Known.SignBit ;
605
575
}
606
576
0 commit comments