diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-11-07 09:39:38 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-11-07 09:39:38 +0000 |
commit | c85352a191c6a32abd2790e368da9d0300a6c03f (patch) | |
tree | 67d9b54bc13a4235e50c5de54720dd5e4a632978 /gcc/ada | |
parent | 53d01a992f7253ca8bdb93e02281fe4d135d3153 (diff) | |
download | gcc-c85352a191c6a32abd2790e368da9d0300a6c03f.tar.gz |
* gcc-interface/trans.c (build_binary_op_trapv): Avoid emitting
overflow check for constant result.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@141666 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f9d899309ba..68f0623539d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,10 @@ 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 overflow check for addition/subtraction if neither operand is constant. diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 5d56ef84cb1..aca7167bae0 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -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); |