re PR middle-end/32492 (attribute always_inline -> sorry, unimplemented: recursive inlining)

2007-06-27  Richard Guenther  <rguenther@suse.de>

	PR middle-end/32492
	* tree.h (fold_convertible_p): Declare.
	* fold-const.c (fold_convertible_p): New function.
	* gimplify.c (gimplify_call_expr): Use fold_convertible_p
	instead of lang_hooks.types_compatible_p.

	* gcc.dg/inline-22.c: New testcase.

From-SVN: r126054
This commit is contained in:
Richard Guenther 2007-06-27 14:01:27 +00:00 committed by Richard Biener
parent 95e88efd10
commit 3b35764639
6 changed files with 57 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2007-06-27 Richard Guenther <rguenther@suse.de>
PR middle-end/32492
* tree.h (fold_convertible_p): Declare.
* fold-const.c (fold_convertible_p): New function.
* gimplify.c (gimplify_call_expr): Use fold_convertible_p
instead of lang_hooks.types_compatible_p.
2007-06-26 Jan Hubicka <jh@suse.cz>
* fwprop.c (try_fwprop_subst): Use validate_unshare_change.

View File

@ -2211,6 +2211,40 @@ build_zero_vector (tree type)
return build_vector (type, list);
}
/* Returns true, if ARG is convertible to TYPE using a NOP_EXPR. */
bool
fold_convertible_p (tree type, tree arg)
{
tree orig = TREE_TYPE (arg);
if (type == orig)
return true;
if (TREE_CODE (arg) == ERROR_MARK
|| TREE_CODE (type) == ERROR_MARK
|| TREE_CODE (orig) == ERROR_MARK)
return false;
if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (orig))
return true;
switch (TREE_CODE (type))
{
case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
case POINTER_TYPE: case REFERENCE_TYPE:
case OFFSET_TYPE:
if (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig)
|| TREE_CODE (orig) == OFFSET_TYPE)
return true;
return (TREE_CODE (orig) == VECTOR_TYPE
&& tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig)));
default:
return TREE_CODE (type) == TREE_CODE (orig);
}
}
/* Convert expression ARG to type TYPE. Used by the middle-end for
simple conversions in preference to calling the front-end's convert. */

View File

@ -2141,8 +2141,7 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
if (!p
|| TREE_VALUE (p) == error_mark_node
|| CALL_EXPR_ARG (*expr_p, i) == error_mark_node
|| !lang_hooks.types_compatible_p
(TREE_TYPE (CALL_EXPR_ARG (*expr_p, i)), TREE_VALUE (p)))
|| !fold_convertible_p (TREE_VALUE (p), CALL_EXPR_ARG (*expr_p, i)))
{
CALL_CANNOT_INLINE_P (*expr_p) = 1;
break;
@ -2155,8 +2154,7 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
if (!p
|| p == error_mark_node
|| CALL_EXPR_ARG (*expr_p, i) == error_mark_node
|| !lang_hooks.types_compatible_p
(TREE_TYPE (CALL_EXPR_ARG (*expr_p, i)), TREE_TYPE (p)))
|| !fold_convertible_p (TREE_TYPE (p), CALL_EXPR_ARG (*expr_p, i)))
{
CALL_CANNOT_INLINE_P (*expr_p) = 1;
break;

View File

@ -1,3 +1,8 @@
2007-06-27 Richard Guenther <rguenther@suse.de>
PR middle-end/32492
* gcc.dg/inline-22.c: New testcase.
2007-06-26 Hui-May Chang <hm.chang@apple.com>
* gcc.target/i386/large-size-array-3.c: Remove the larger size of

View File

@ -0,0 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-funit-at-a-time" } */
/* Verify we can inline without a complete prototype and with promoted
arguments. See also PR32492. */
__attribute__((always_inline)) void f1() {}
__attribute__((always_inline)) void f2(char x) {}
void f3() { f1(); f2(0); }

View File

@ -4444,6 +4444,7 @@ extern tree fold_build2_initializer (enum tree_code, tree, tree, tree);
extern tree fold_build3_initializer (enum tree_code, tree, tree, tree, tree);
extern tree fold_build_call_array (tree, tree, int, tree *);
extern tree fold_build_call_array_initializer (tree, tree, int, tree *);
extern bool fold_convertible_p (tree, tree);
extern tree fold_convert (tree, tree);
extern tree fold_single_bit_test (enum tree_code, tree, tree, tree);
extern tree fold_ignored_result (tree);