If we don't HONOR_NANS we should not try to use any unordered
comparison results. Best case those will just be optimized away;
realistically, they ICE. For example, the rs6000 backend has some
code that specifically checks we never do this.
PR tree-optimization/88055
* tree-call-cdce.c (comparison_code_if_no_nans): New function.
(gen_one_condition): Use it if !HONOR_NANS.
From-SVN: r270460
+2019-04-19 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR tree-optimization/88055
+ * tree-call-cdce.c (comparison_code_if_no_nans): New function.
+ (gen_one_condition): Use it if !HONOR_NANS.
+
2019-04-19 Jakub Jelinek <jakub@redhat.com>
PR middle-end/90139
|| find_fallthru_edge (gimple_bb (call)->succs));
}
\f
+/* For a comparison code return the comparison code we should use if we don't
+ HONOR_NANS. */
+
+static enum tree_code
+comparison_code_if_no_nans (tree_code code)
+{
+ switch (code)
+ {
+ case UNLT_EXPR:
+ return LT_EXPR;
+ case UNGT_EXPR:
+ return GT_EXPR;
+ case UNLE_EXPR:
+ return LE_EXPR;
+ case UNGE_EXPR:
+ return GE_EXPR;
+ case UNEQ_EXPR:
+ return EQ_EXPR;
+ case LTGT_EXPR:
+ return NE_EXPR;
+
+ case LT_EXPR:
+ case GT_EXPR:
+ case LE_EXPR:
+ case GE_EXPR:
+ case EQ_EXPR:
+ case NE_EXPR:
+ return code;
+
+ default:
+ gcc_unreachable ();
+ }
+}
+
/* A helper function to generate gimple statements for one bound
comparison, so that the built-in function is called whenever
TCODE <ARG, LBUB> is *false*. TEMP_NAME1/TEMP_NAME2 are names
vec<gimple *> conds,
unsigned *nconds)
{
+ if (!HONOR_NANS (arg))
+ tcode = comparison_code_if_no_nans (tcode);
+
tree lbub_real_cst, lbub_cst, float_type;
tree temp, tempn, tempc, tempcn;
gassign *stmt1;