{
if (rel != VREL_EQ)
range_cast (equiv_range, type);
+ else
+ adjust_equivalence_range (equiv_range);
+
if (block_result.intersect (equiv_range))
{
if (DEBUG_RANGE_CACHE)
--- /dev/null
+/* PR tree-optimization/111009 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+#define signbit(x) __builtin_signbit(x)
+
+static void test(double l, double r)
+{
+ if (l == r && (signbit(l) || signbit(r)))
+ ;
+ else
+ __builtin_abort();
+}
+
+int main()
+{
+ test(0.0, -0.0);
+}
+
return relation_kind (rr_transitive_table[r1][r2]);
}
+// 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)
+{
+ if (range.undefined_p () || !is_a<frange> (range))
+ return;
+
+ 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.
static const tree_code relation_to_code [VREL_LAST] = {
void print_relation (FILE *f, relation_kind rel);
+// Adjust range as an equivalence.
+void adjust_equivalence_range (vrange &range);
+
class relation_oracle
{
public: