+2018-08-22 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/86945
+ * tree-cfg.c (generate_range_test): Use unsigned arithmetic.
+
2018-08-22 Alexandre Oliva <oliva@adacore.com>
* config/rs6000/rs6000.c (SMALL_DATA_RELOC, SMALL_DATA_REG): Add
tree type = TREE_TYPE (index);
tree utype = unsigned_type_for (type);
- low = fold_convert (type, low);
- high = fold_convert (type, high);
+ low = fold_convert (utype, low);
+ high = fold_convert (utype, high);
- tree tmp = make_ssa_name (type);
- gassign *sub1
- = gimple_build_assign (tmp, MINUS_EXPR, index, low);
+ gimple_seq seq = NULL;
+ index = gimple_convert (&seq, utype, index);
+ *lhs = gimple_build (&seq, MINUS_EXPR, utype, index, low);
+ *rhs = const_binop (MINUS_EXPR, utype, high, low);
- *lhs = make_ssa_name (utype);
- gassign *a = gimple_build_assign (*lhs, NOP_EXPR, tmp);
-
- *rhs = fold_build2 (MINUS_EXPR, utype, high, low);
gimple_stmt_iterator gsi = gsi_last_bb (bb);
- gsi_insert_before (&gsi, sub1, GSI_SAME_STMT);
- gsi_insert_before (&gsi, a, GSI_SAME_STMT);
+ gsi_insert_seq_before (&gsi, seq, GSI_SAME_STMT);
}
/* Emit return warnings. */