Commit d94e3e75 by Richard Biener Committed by Richard Biener

re PR tree-optimization/64853 (wrong code at -Os and above on x86_64-linux-gnu)

2015-01-29  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/64853
	* tree-vrp.c (vrp_valueize_1): Do not return anything if the
	stmt will get simulated again.
	* tree-ssa-ccp.c (valueize_op_1): Likewise.

	* gcc.dg/torture/pr64853.c: New testcase.

From-SVN: r220247
parent 16277100
2015-01-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/64853
* tree-vrp.c (vrp_valueize_1): Do not return anything if the
stmt will get simulated again.
* tree-ssa-ccp.c (valueize_op_1): Likewise.
2015-01-29 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2015-01-29 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/arm/arm.c (arm_emit_multi_reg_pop): Simplify definition of * config/arm/arm.c (arm_emit_multi_reg_pop): Simplify definition of
......
2015-01-29 Richard Biener <rguenther@suse.de> 2015-01-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/64853
* gcc.dg/torture/pr64853.c: New testcase.
2015-01-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/64844 PR tree-optimization/64844
* gcc.dg/vect/pr64844.c: New testcase. * gcc.dg/vect/pr64844.c: New testcase.
......
/* { dg-do run } */
struct S
{
int f1;
};
static struct S a = { 1 };
char b;
static unsigned char *c = &b;
int d, e, f;
int
fn1 (int p)
{
return 0 ? 0 : p - 1;
}
static int
fn2 (struct S p)
{
int g = 200;
for (e = 4; e; e = fn1 (e))
{
for (; d; d++)
;
*c &= p.f1 & g;
g = --*c;
if (f)
return 0;
}
return 0;
}
int
main ()
{
fn2 (a);
if (b != 0)
__builtin_abort ();
return 0;
}
...@@ -1141,15 +1141,15 @@ valueize_op_1 (tree op) ...@@ -1141,15 +1141,15 @@ valueize_op_1 (tree op)
{ {
if (TREE_CODE (op) == SSA_NAME) if (TREE_CODE (op) == SSA_NAME)
{ {
tree tem = get_constant_value (op);
if (tem)
return tem;
/* If the definition may be simulated again we cannot follow /* If the definition may be simulated again we cannot follow
this SSA edge as the SSA propagator does not necessarily this SSA edge as the SSA propagator does not necessarily
re-visit the use. */ re-visit the use. */
gimple def_stmt = SSA_NAME_DEF_STMT (op); gimple def_stmt = SSA_NAME_DEF_STMT (op);
if (prop_simulate_again_p (def_stmt)) if (prop_simulate_again_p (def_stmt))
return NULL_TREE; return NULL_TREE;
tree tem = get_constant_value (op);
if (tem)
return tem;
} }
return op; return op;
} }
......
...@@ -7092,15 +7092,15 @@ vrp_valueize_1 (tree name) ...@@ -7092,15 +7092,15 @@ vrp_valueize_1 (tree name)
{ {
if (TREE_CODE (name) == SSA_NAME) if (TREE_CODE (name) == SSA_NAME)
{ {
value_range_t *vr = get_value_range (name);
if (range_int_cst_singleton_p (vr))
return vr->min;
/* If the definition may be simulated again we cannot follow /* If the definition may be simulated again we cannot follow
this SSA edge as the SSA propagator does not necessarily this SSA edge as the SSA propagator does not necessarily
re-visit the use. */ re-visit the use. */
gimple def_stmt = SSA_NAME_DEF_STMT (name); gimple def_stmt = SSA_NAME_DEF_STMT (name);
if (prop_simulate_again_p (def_stmt)) if (prop_simulate_again_p (def_stmt))
return NULL_TREE; return NULL_TREE;
value_range_t *vr = get_value_range (name);
if (range_int_cst_singleton_p (vr))
return vr->min;
} }
return name; return name;
} }
......
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