Commit f3842847 by Yury Gribov Committed by Yury Gribov

re PR tree-optimization/87633 (ice in compare_range_wit h_value, at vr-values.c:1702)

2018-10-22  Yury Gribov  <tetra2005@gmail.com>

gcc/
	PR tree-optimization/87633
	* match.pd: Do not generate unordered integer comparisons.

gcc/testsuite/
	PR tree-optimization/87633
	* g++.dg/pr87633.C: New test.

From-SVN: r265399
parent 8d2d3958
2018-10-22 Yury Gribov <tetra2005@gmail.com>
PR tree-optimization/87633
* match.pd: Do not generate unordered integer comparisons.
2018-10-22 Segher Boessenkool <segher@kernel.crashing.org> 2018-10-22 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/87600 PR rtl-optimization/87600
...@@ -3401,7 +3401,8 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) ...@@ -3401,7 +3401,8 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(cmp @0 @1)))))) (cmp @0 @1))))))
/* Optimize various special cases of (FTYPE) N CMP (FTYPE) M. */ /* Optimize various special cases of (FTYPE) N CMP (FTYPE) M. */
(for cmp (tcc_comparison) (for cmp (lt le eq ne ge gt unordered ordered unlt unle ungt unge uneq ltgt)
icmp (lt le eq ne ge gt unordered ordered lt le gt ge eq ne)
(simplify (simplify
(cmp (float@0 @1) (float @2)) (cmp (float@0 @1) (float @2))
(if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (@0)) (if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (@0))
...@@ -3416,15 +3417,17 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) ...@@ -3416,15 +3417,17 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
} }
(if (fmt.can_represent_integral_type_p (type1) (if (fmt.can_represent_integral_type_p (type1)
&& fmt.can_represent_integral_type_p (type2)) && fmt.can_represent_integral_type_p (type2))
(if (TYPE_PRECISION (type1) > TYPE_PRECISION (type2) (if (cmp == ORDERED_EXPR || cmp == UNORDERED_EXPR)
&& type1_signed_p >= type2_signed_p) { constant_boolean_node (cmp == ORDERED_EXPR, type); }
(cmp @1 (convert @2)) (if (TYPE_PRECISION (type1) > TYPE_PRECISION (type2)
(if (TYPE_PRECISION (type1) < TYPE_PRECISION (type2) && type1_signed_p >= type2_signed_p)
&& type1_signed_p <= type2_signed_p) (icmp @1 (convert @2))
(cmp (convert:type2 @1) @2) (if (TYPE_PRECISION (type1) < TYPE_PRECISION (type2)
(if (TYPE_PRECISION (type1) == TYPE_PRECISION (type2) && type1_signed_p <= type2_signed_p)
&& type1_signed_p == type2_signed_p) (icmp (convert:type2 @1) @2)
(cmp @1 @2))))))))) (if (TYPE_PRECISION (type1) == TYPE_PRECISION (type2)
&& type1_signed_p == type2_signed_p)
(icmp @1 @2))))))))))
/* Optimize various special cases of (FTYPE) N CMP CST. */ /* Optimize various special cases of (FTYPE) N CMP CST. */
(for cmp (lt le eq ne ge gt) (for cmp (lt le eq ne ge gt)
......
2018-10-22 Yury Gribov <tetra2005@gmail.com>
PR tree-optimization/87633
* g++.dg/pr87633.C: New test.
2018-10-22 Marek Polacek <polacek@redhat.com> 2018-10-22 Marek Polacek <polacek@redhat.com>
PR testsuite/87694 PR testsuite/87694
......
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
class a {
public:
double b() const;
};
class c {
public:
int m_fn2() const;
};
double a::b() const {
return 0 == 0 ? reinterpret_cast<const c *>(this)->m_fn2() : 0;
}
bool d;
void e() {
a f;
double g = f.b();
/* { dg-final { scan-tree-dump-not "unord" "optimized" } } */
d = __builtin_isnan(g);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment