File tree Expand file tree Collapse file tree 2 files changed +5
-14
lines changed
Expand file tree Collapse file tree 2 files changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -913,9 +913,8 @@ class CmpInst : public Instruction {
913913 bool isEquality () const { return isEquality (getPredicate ()); }
914914
915915 // / Determine if one operand of this compare can always be replaced by the
916- // / other operand, ignoring provenance considerations. If \p Invert is false,
917- // / check for equivalence with an equals predicate; otherwise, check for
918- // / equivalence with a not-equals predicate.
916+ // / other operand, ignoring provenance considerations. If \p Invert, check for
917+ // / equivalence with the inverse predicate.
919918 bool isEquivalence (bool Invert = false ) const ;
920919
921920 // / Return true if the predicate is relational (not EQ or NE).
Original file line number Diff line number Diff line change @@ -3488,23 +3488,15 @@ static bool hasNonZeroFPOperands(const CmpInst *Cmp) {
34883488// -0.0, when comparing NaN with another value, or when flushing
34893489// denormals-to-zero.
34903490bool CmpInst::isEquivalence (bool Invert) const {
3491- switch (getPredicate ()) {
3491+ switch (Invert ? getInversePredicate () : getPredicate ()) {
34923492 case CmpInst::Predicate::ICMP_EQ:
3493- return !Invert;
3494- case CmpInst::Predicate::ICMP_NE:
3495- return Invert;
3493+ return true ;
34963494 case CmpInst::Predicate::FCMP_UEQ:
34973495 if (!hasNoNaNs ())
34983496 return false ;
34993497 [[fallthrough]];
35003498 case CmpInst::Predicate::FCMP_OEQ:
3501- return !Invert && hasNonZeroFPOperands (this );
3502- case CmpInst::Predicate::FCMP_ONE:
3503- if (!hasNoNaNs ())
3504- return false ;
3505- [[fallthrough]];
3506- case CmpInst::Predicate::FCMP_UNE:
3507- return Invert && hasNonZeroFPOperands (this );
3499+ return hasNonZeroFPOperands (this );
35083500 default :
35093501 return false ;
35103502 }
You can’t perform that action at this time.
0 commit comments