diff options
author | Andrew Pinski <pinskia@gcc.gnu.org> | 2006-06-19 19:09:57 -0700 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2006-06-19 19:09:57 -0700 |
commit | 73dab33bce6cc186f05ac0cf45e42c58f9086b3c (patch) | |
tree | 70fce683565be251ca9b5d49fd3d814bfcf5a973 /gcc | |
parent | 48e2909e4a9d520a083d213999c926bf135ebed2 (diff) | |
download | gcc-73dab33bce6cc186f05ac0cf45e42c58f9086b3c.zip gcc-73dab33bce6cc186f05ac0cf45e42c58f9086b3c.tar.gz gcc-73dab33bce6cc186f05ac0cf45e42c58f9086b3c.tar.bz2 |
re PR middle-end/28075 (inliner introduces unnecessary type conversions)
2006-06-19 Andrew Pinski <pinskia@gmail.com>
PR middle-end/28075
* tree-inline.c (setup_one_parameter): Strip useless
type conversion before adding it to the IR.
(declare_return_variable): Likewise.
2006-06-19 Andrew Pinski <pinskia@gmail.com>
PR middle-end/28075
* gcc.dg/tree-ssa/inline-1.c: New test.
From-SVN: r114801
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/inline-1.c | 25 | ||||
-rw-r--r-- | gcc/tree-inline.c | 4 |
4 files changed, 42 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8d1e6d0..3948911 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2006-06-19 Andrew Pinski <pinskia@gmail.com> + + PR middle-end/28075 + * tree-inline.c (setup_one_parameter): Strip useless + type conversion before adding it to the IR. + (declare_return_variable): Likewise. + 2006-06-19 Martin Michlmayr <tbm@cyrius.com> PR c/27149 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 50ead2c..96c8628 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,4 +1,9 @@ -2006-06-19 Anatoly Sokolov <aesok@post.ru> +2006-06-19 Andrew Pinski <pinskia@gmail.com> + + PR middle-end/28075 + * gcc.dg/tree-ssa/inline-1.c: New test. + +2006-06-19 Anatoly Sokolov <aesok@post.ru> * gcc.dg/pr18241-1.c: Use __SIZE_TYPE__ instead of unsigned long in malloc prototype; remove XFAIL. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/inline-1.c b/gcc/testsuite/gcc.dg/tree-ssa/inline-1.c new file mode 100644 index 0000000..bbf7e83 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/inline-1.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-final_cleanup" } */ + + +typedef struct { + double min; + double max; +} interval; +inline interval add(interval x, interval y) __attribute__((always_inline)); +inline interval add(interval x, interval y) +{ + interval r; + r.min = x.min + y.min; + r.max = x.max + y.max; + return r; +} +interval foo (interval a, interval b, interval c) +{ + return add (a, add (b, c)); +} + + +/* { dg-final { scan-tree-dump-times "\(struct interval\)" 0 "final_cleanup"} } */ +/* { dg-final { cleanup-tree-dump "final_cleanup" } } */ + diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 3aeb7b6..4749be5 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1081,6 +1081,8 @@ setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn, if (rhs == error_mark_node) return; + + STRIP_USELESS_TYPE_CONVERSION (rhs); /* We want to use MODIFY_EXPR, not INIT_EXPR here so that we keep our trees in gimple form. */ @@ -1267,6 +1269,8 @@ declare_return_variable (copy_body_data *id, tree return_slot_addr, use = var; if (!lang_hooks.types_compatible_p (TREE_TYPE (var), caller_type)) use = fold_convert (caller_type, var); + + STRIP_USELESS_TYPE_CONVERSION (use); done: /* Register the VAR_DECL as the equivalent for the RESULT_DECL; that |