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
This commit is contained in:
Andrew Pinski 2006-06-19 19:09:57 -07:00
parent 48e2909e4a
commit 73dab33bce
4 changed files with 42 additions and 1 deletions

View File

@ -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

View File

@ -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.

View File

@ -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" } } */

View File

@ -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