trans.c (build_binary_op_trapv): Avoid emitting overflow check for constant result.

* gcc-interface/trans.c (build_binary_op_trapv): Avoid emitting
	overflow check for constant result.

From-SVN: r141666
This commit is contained in:
Geert Bosch 2008-11-07 09:39:38 +00:00 committed by Eric Botcazou
parent 4ae393838b
commit 2575024c21
2 changed files with 9 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2008-11-07 Geert Bosch <bosch@adacore.com>
* gcc-interface/trans.c (build_binary_op_trapv): Avoid emitting
overflow check for constant result.
2008-11-07 Geert Bosch <bosch@adacore.com>
* gcc-interface/trans.c (build_binary_op_trapv): Use more efficient

View File

@ -6146,6 +6146,10 @@ build_binary_op_trapv (enum tree_code code,
gnu_expr = build_binary_op (code, gnu_type, lhs, rhs);
/* If we can fold the expression to a constant, just return it.
The caller will deal with overflow, no need to generate a check. */
if (TREE_CONSTANT (gnu_expr)) return gnu_expr;
check = fold_build3 (COND_EXPR, integer_type_node,
rhs_lt_zero, check_neg, check_pos);