@@ -397,7 +397,7 @@ struct SDNodeFlags {
397397 Exact = 1 << 2 ,
398398 Disjoint = 1 << 3 ,
399399 NonNeg = 1 << 4 ,
400- NoNaNs = 1 << 5 ,
400+ // 1 << 5 was used as NoNaNs
401401 NoInfs = 1 << 6 ,
402402 NoSignedZeros = 1 << 7 ,
403403 AllowReciprocal = 1 << 8 ,
@@ -416,21 +416,26 @@ struct SDNodeFlags {
416416 // Compare instructions which may carry the samesign flag.
417417 SameSign = 1 << 14 ,
418418
419+ NoSNaNs = 1 << 15 ,
420+ NoQNaNs = 1 << 16 ,
421+
419422 // NOTE: Please update LargestValue in LLVM_DECLARE_ENUM_AS_BITMASK below
420423 // the class definition when adding new flags.
421424
422425 PoisonGeneratingFlags = NoUnsignedWrap | NoSignedWrap | Exact | Disjoint |
423- NonNeg | NoNaNs | NoInfs | SameSign,
424- FastMathFlags = NoNaNs | NoInfs | NoSignedZeros | AllowReciprocal |
425- AllowContract | ApproximateFuncs | AllowReassociation,
426+ NonNeg | NoSNaNs | NoQNaNs | NoInfs | SameSign,
427+ FastMathFlags = NoSNaNs | NoQNaNs | NoInfs | NoSignedZeros |
428+ AllowReciprocal | AllowContract | ApproximateFuncs |
429+ AllowReassociation,
426430 };
427431
428432 // / Default constructor turns off all optimization flags.
429433 SDNodeFlags (unsigned Flags = SDNodeFlags::None) : Flags(Flags) {}
430434
431435 // / Propagate the fast-math-flags from an IR FPMathOperator.
432436 void copyFMF (const FPMathOperator &FPMO) {
433- setNoNaNs (FPMO.hasNoNaNs ());
437+ setNoSNaNs (FPMO.hasNoNaNs ());
438+ setNoQNaNs (FPMO.hasNoNaNs ());
434439 setNoInfs (FPMO.hasNoInfs ());
435440 setNoSignedZeros (FPMO.hasNoSignedZeros ());
436441 setAllowReciprocal (FPMO.hasAllowReciprocal ());
@@ -446,7 +451,12 @@ struct SDNodeFlags {
446451 void setDisjoint (bool b) { setFlag<Disjoint>(b); }
447452 void setSameSign (bool b) { setFlag<SameSign>(b); }
448453 void setNonNeg (bool b) { setFlag<NonNeg>(b); }
449- void setNoNaNs (bool b) { setFlag<NoNaNs>(b); }
454+ void setNoNaNs (bool b) {
455+ setFlag<NoSNaNs>(b);
456+ setFlag<NoQNaNs>(b);
457+ }
458+ void setNoSNaNs (bool b) { setFlag<NoSNaNs>(b); }
459+ void setNoQNaNs (bool b) { setFlag<NoQNaNs>(b); }
450460 void setNoInfs (bool b) { setFlag<NoInfs>(b); }
451461 void setNoSignedZeros (bool b) { setFlag<NoSignedZeros>(b); }
452462 void setAllowReciprocal (bool b) { setFlag<AllowReciprocal>(b); }
@@ -463,7 +473,9 @@ struct SDNodeFlags {
463473 bool hasDisjoint () const { return Flags & Disjoint; }
464474 bool hasSameSign () const { return Flags & SameSign; }
465475 bool hasNonNeg () const { return Flags & NonNeg; }
466- bool hasNoNaNs () const { return Flags & NoNaNs; }
476+ bool hasNoNaNs () const { return (Flags & NoSNaNs) && (Flags & NoQNaNs); }
477+ bool hasNoSNaNs () const { return Flags & NoSNaNs; }
478+ bool hasNoQNaNs () const { return Flags & NoQNaNs; }
467479 bool hasNoInfs () const { return Flags & NoInfs; }
468480 bool hasNoSignedZeros () const { return Flags & NoSignedZeros; }
469481 bool hasAllowReciprocal () const { return Flags & AllowReciprocal; }
0 commit comments