diff options
Diffstat (limited to 'gcc/value-relation.cc')
-rw-r--r-- | gcc/value-relation.cc | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc index 8fea4aa..c0f513a 100644 --- a/gcc/value-relation.cc +++ b/gcc/value-relation.cc @@ -183,19 +183,24 @@ relation_transitive (relation_kind r1, relation_kind r2) return relation_kind (rr_transitive_table[r1][r2]); } -// When operands of a statement are identical ssa_names, return the -// approriate relation between operands for NAME == NAME, given RANGE. -// -relation_kind -get_identity_relation (tree name, vrange &range ATTRIBUTE_UNUSED) +// When one name is an equivalence of another, ensure the equivalence +// range is correct. Specifically for floating point, a +0 is also +// equivalent to a -0 which may not be reflected. See PR 111694. + +void +adjust_equivalence_range (vrange &range) { - // Return VREL_UNEQ when it is supported for floats as appropriate. - if (frange::supports_p (TREE_TYPE (name))) - return VREL_EQ; + if (range.undefined_p () || !is_a<frange> (range)) + return; - // Otherwise return VREL_EQ. - return VREL_EQ; -} + frange fr = as_a<frange> (range); + // If range includes 0 make sure both signs of zero are included. + if (fr.contains_p (dconst0) || fr.contains_p (dconstm0)) + { + frange zeros (range.type (), dconstm0, dconst0); + range.union_ (zeros); + } + } // This vector maps a relation to the equivalent tree code. @@ -387,6 +392,9 @@ equiv_oracle::add_partial_equiv (relation_kind r, tree op1, tree op2) // In either case, if PE2 has an entry, we simply do nothing. if (pe2.members) return; + // If there are no uses of op2, do not register. + if (has_zero_uses (op2)) + return; // PE1 is the LHS and already has members, so everything in the set // should be a slice of PE2 rather than PE1. pe2.code = pe_min (r, pe1.code); @@ -404,6 +412,9 @@ equiv_oracle::add_partial_equiv (relation_kind r, tree op1, tree op2) } if (pe2.members) { + // If there are no uses of op1, do not register. + if (has_zero_uses (op1)) + return; pe1.ssa_base = pe2.ssa_base; // If pe2 is a 16 bit value, but only an 8 bit copy, we can't be any // more than an 8 bit equivalence here, so choose MIN value. @@ -413,6 +424,9 @@ equiv_oracle::add_partial_equiv (relation_kind r, tree op1, tree op2) } else { + // If there are no uses of either operand, do not register. + if (has_zero_uses (op1) || has_zero_uses (op2)) + return; // Neither name has an entry, simply create op1 as slice of op2. pe2.code = bits_to_pe (TYPE_PRECISION (TREE_TYPE (op2))); if (pe2.code == VREL_VARYING) |