diff options
author | Jakub Jelinek <jakub@redhat.com> | 2014-12-04 10:46:45 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2014-12-04 10:46:45 +0100 |
commit | c05eeebc177336309489b7abaf03e9e8e623bae3 (patch) | |
tree | 0d387792bdbd70ac6bf8e464a09d737336f1eb6c /gcc/convert.c | |
parent | 7155ec314a4d59ae658eaaa490f31b76c81e476a (diff) |
re PR c++/56493 (Performance regression in google dense hashmap)
PR c++/56493
* convert.c (convert_to_real, convert_to_expr, convert_to_complex):
Handle COMPOUND_EXPR.
* c-c++-common/pr56493.c: New test.
From-SVN: r218345
Diffstat (limited to 'gcc/convert.c')
-rw-r--r-- | gcc/convert.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/convert.c b/gcc/convert.c index 07e2d75e5ee..00907290c21 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -99,6 +99,15 @@ convert_to_real (tree type, tree expr) enum built_in_function fcode = builtin_mathfn_code (expr); tree itype = TREE_TYPE (expr); + if (TREE_CODE (expr) == COMPOUND_EXPR) + { + tree t = convert_to_real (type, TREE_OPERAND (expr, 1)); + if (t == TREE_OPERAND (expr, 1)) + return expr; + return build2_loc (EXPR_LOCATION (expr), COMPOUND_EXPR, TREE_TYPE (t), + TREE_OPERAND (expr, 0), t); + } + /* Disable until we figure out how to decide whether the functions are present in runtime. */ /* Convert (float)sqrt((double)x) where x is float into sqrtf(x) */ @@ -406,6 +415,15 @@ convert_to_integer (tree type, tree expr) return error_mark_node; } + if (ex_form == COMPOUND_EXPR) + { + tree t = convert_to_integer (type, TREE_OPERAND (expr, 1)); + if (t == TREE_OPERAND (expr, 1)) + return expr; + return build2_loc (EXPR_LOCATION (expr), COMPOUND_EXPR, TREE_TYPE (t), + TREE_OPERAND (expr, 0), t); + } + /* Convert e.g. (long)round(d) -> lround(d). */ /* If we're converting to char, we may encounter differing behavior between converting from double->char vs double->long->char. @@ -926,6 +944,14 @@ convert_to_complex (tree type, tree expr) if (TYPE_MAIN_VARIANT (elt_type) == TYPE_MAIN_VARIANT (subtype)) return expr; + else if (TREE_CODE (expr) == COMPOUND_EXPR) + { + tree t = convert_to_complex (type, TREE_OPERAND (expr, 1)); + if (t == TREE_OPERAND (expr, 1)) + return expr; + return build2_loc (EXPR_LOCATION (expr), COMPOUND_EXPR, + TREE_TYPE (t), TREE_OPERAND (expr, 0), t); + } else if (TREE_CODE (expr) == COMPLEX_EXPR) return fold_build2 (COMPLEX_EXPR, type, convert (subtype, TREE_OPERAND (expr, 0)), |