Commit 1b248907 by Richard Guenther Committed by Richard Biener

re PR tree-optimization/46076 (constant propagation and compile-time math no…

re PR tree-optimization/46076 (constant propagation and compile-time math no longer happening versus 4.4 and 4.5)

2011-01-11  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/46076
	* tree-ssa.c (useless_type_conversion_p): Conversions from
	unprototyped to empty argument list function types are useless.

	* gcc.dg/tree-ssa/pr46076.c: New testcase.

From-SVN: r168665
parent 403c753b
2011-01-11 Richard Guenther <rguenther@suse.de>
PR tree-optimization/46076
* tree-ssa.c (useless_type_conversion_p): Conversions from
unprototyped to empty argument list function types are useless.
2011-01-11 Richard Guenther <rguenther@suse.de>
PR middle-end/45235
* emit-rtl.c (set_mem_attributes_minus_bitpos): Do not mark
volatile MEMs as MEM_READONLY_P.
......
2011-01-11 Richard Guenther <rguenther@suse.de>
PR tree-optimization/46076
* gcc.dg/tree-ssa/pr46076.c: New testcase.
2011-01-11 Jeff Law <law@redhat.com>
* PR tree-optimization/47086
......
/* { dg-do link } */
/* { dg-options "-O2" } */
extern void link_error (void);
typedef unsigned char(*Calculable)(void);
static unsigned char one() { return 1; }
static unsigned char two() { return 2; }
static int
print(Calculable calculate)
{
return calculate() + calculate() + 1;
}
int
main()
{
/* Make sure we perform indirect inlining of one and two and optimize
the result to a constant. */
if (print(one) != 3)
link_error ();
if (print(two) != 5)
link_error ();
return 0;
}
......@@ -1410,6 +1410,11 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
if (!prototype_p (outer_type))
return true;
/* A conversion between unprototyped and empty argument list is ok. */
if (TYPE_ARG_TYPES (outer_type) == void_list_node
&& !prototype_p (inner_type))
return true;
/* If the unqualified argument types are compatible the conversion
is useless. */
if (TYPE_ARG_TYPES (outer_type) == TYPE_ARG_TYPES (inner_type))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment