Fix compute_complex_assign_jump_func
2017-01-23 Martin Jambor <mjambor@suse.cz> * ipa-prop.c (load_from_param_1): Removed. (load_from_unmodified_param): Bits from load_from_param_1 put back here. (load_from_param): Removed. (compute_complex_assign_jump_func): Removed stmt2 and just replaced it with stmt. Reverted back to use of load_from_unmodified_param. testsuite/ * gcc.dg/ipa/vrp8.c: New test. From-SVN: r244803
This commit is contained in:
parent
f65f1ae3b9
commit
bda2bc48c2
|
@ -1,3 +1,12 @@
|
||||||
|
2017-01-23 Martin Jambor <mjambor@suse.cz>
|
||||||
|
|
||||||
|
* ipa-prop.c (load_from_param_1): Removed.
|
||||||
|
(load_from_unmodified_param): Bits from load_from_param_1 put back
|
||||||
|
here.
|
||||||
|
(load_from_param): Removed.
|
||||||
|
(compute_complex_assign_jump_func): Removed stmt2 and just replaced it
|
||||||
|
with stmt. Reverted back to use of load_from_unmodified_param.
|
||||||
|
|
||||||
2017-01-23 Martin Jambor <mjambor@suse.cz>
|
2017-01-23 Martin Jambor <mjambor@suse.cz>
|
||||||
|
|
||||||
PR ipa/79108
|
PR ipa/79108
|
||||||
|
|
|
@ -862,19 +862,21 @@ parm_preserved_before_stmt_p (struct ipa_func_body_info *fbi, int index,
|
||||||
return !modified;
|
return !modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Main worker for load_from_unmodified_param and load_from_param.
|
/* If STMT is an assignment that loads a value from an parameter declaration,
|
||||||
If STMT is an assignment that loads a value from an parameter declaration,
|
return the index of the parameter in ipa_node_params which has not been
|
||||||
return the index of the parameter in ipa_node_params. Otherwise return -1. */
|
modified. Otherwise return -1. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
load_from_param_1 (struct ipa_func_body_info *fbi,
|
load_from_unmodified_param (struct ipa_func_body_info *fbi,
|
||||||
vec<ipa_param_descriptor, va_gc> *descriptors,
|
vec<ipa_param_descriptor, va_gc> *descriptors,
|
||||||
gimple *stmt)
|
gimple *stmt)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
tree op1;
|
tree op1;
|
||||||
|
|
||||||
gcc_checking_assert (is_gimple_assign (stmt));
|
if (!gimple_assign_single_p (stmt))
|
||||||
|
return -1;
|
||||||
|
|
||||||
op1 = gimple_assign_rhs1 (stmt);
|
op1 = gimple_assign_rhs1 (stmt);
|
||||||
if (TREE_CODE (op1) != PARM_DECL)
|
if (TREE_CODE (op1) != PARM_DECL)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -887,40 +889,6 @@ load_from_param_1 (struct ipa_func_body_info *fbi,
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If STMT is an assignment that loads a value from an parameter declaration,
|
|
||||||
return the index of the parameter in ipa_node_params which has not been
|
|
||||||
modified. Otherwise return -1. */
|
|
||||||
|
|
||||||
static int
|
|
||||||
load_from_unmodified_param (struct ipa_func_body_info *fbi,
|
|
||||||
vec<ipa_param_descriptor, va_gc> *descriptors,
|
|
||||||
gimple *stmt)
|
|
||||||
{
|
|
||||||
if (!gimple_assign_single_p (stmt))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return load_from_param_1 (fbi, descriptors, stmt);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If STMT is an assignment that loads a value from an parameter declaration,
|
|
||||||
return the index of the parameter in ipa_node_params. Otherwise return -1. */
|
|
||||||
|
|
||||||
static int
|
|
||||||
load_from_param (struct ipa_func_body_info *fbi,
|
|
||||||
vec<ipa_param_descriptor, va_gc> *descriptors,
|
|
||||||
gimple *stmt)
|
|
||||||
{
|
|
||||||
if (!is_gimple_assign (stmt))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
|
|
||||||
if ((get_gimple_rhs_class (rhs_code) != GIMPLE_SINGLE_RHS)
|
|
||||||
&& (get_gimple_rhs_class (rhs_code) != GIMPLE_UNARY_RHS))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return load_from_param_1 (fbi, descriptors, stmt);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return true if memory reference REF (which must be a load through parameter
|
/* Return true if memory reference REF (which must be a load through parameter
|
||||||
with INDEX) loads data that are known to be unmodified in this function
|
with INDEX) loads data that are known to be unmodified in this function
|
||||||
before reaching statement STMT. */
|
before reaching statement STMT. */
|
||||||
|
@ -1154,7 +1122,6 @@ compute_complex_assign_jump_func (struct ipa_func_body_info *fbi,
|
||||||
tree op1, tc_ssa, base, ssa;
|
tree op1, tc_ssa, base, ssa;
|
||||||
bool reverse;
|
bool reverse;
|
||||||
int index;
|
int index;
|
||||||
gimple *stmt2 = stmt;
|
|
||||||
|
|
||||||
op1 = gimple_assign_rhs1 (stmt);
|
op1 = gimple_assign_rhs1 (stmt);
|
||||||
|
|
||||||
|
@ -1163,16 +1130,13 @@ compute_complex_assign_jump_func (struct ipa_func_body_info *fbi,
|
||||||
if (SSA_NAME_IS_DEFAULT_DEF (op1))
|
if (SSA_NAME_IS_DEFAULT_DEF (op1))
|
||||||
index = ipa_get_param_decl_index (info, SSA_NAME_VAR (op1));
|
index = ipa_get_param_decl_index (info, SSA_NAME_VAR (op1));
|
||||||
else
|
else
|
||||||
{
|
index = load_from_unmodified_param (fbi, info->descriptors,
|
||||||
index = load_from_param (fbi, info->descriptors,
|
SSA_NAME_DEF_STMT (op1));
|
||||||
SSA_NAME_DEF_STMT (op1));
|
|
||||||
stmt2 = SSA_NAME_DEF_STMT (op1);
|
|
||||||
}
|
|
||||||
tc_ssa = op1;
|
tc_ssa = op1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
index = load_from_param (fbi, info->descriptors, stmt);
|
index = load_from_unmodified_param (fbi, info->descriptors, stmt);
|
||||||
tc_ssa = gimple_assign_lhs (stmt);
|
tc_ssa = gimple_assign_lhs (stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1202,11 +1166,11 @@ compute_complex_assign_jump_func (struct ipa_func_body_info *fbi,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GIMPLE_UNARY_RHS:
|
case GIMPLE_UNARY_RHS:
|
||||||
if (is_gimple_assign (stmt2)
|
if (is_gimple_assign (stmt)
|
||||||
&& gimple_assign_rhs_class (stmt2) == GIMPLE_UNARY_RHS
|
&& gimple_assign_rhs_class (stmt) == GIMPLE_UNARY_RHS
|
||||||
&& ! CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt2)))
|
&& ! CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt)))
|
||||||
ipa_set_jf_unary_pass_through (jfunc, index,
|
ipa_set_jf_unary_pass_through (jfunc, index,
|
||||||
gimple_assign_rhs_code (stmt2));
|
gimple_assign_rhs_code (stmt));
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2017-01-23 Martin Jambor <mjambor@suse.cz>
|
||||||
|
|
||||||
|
* gcc.dg/ipa/vrp8.c: New test.
|
||||||
|
|
||||||
2017-01-23 Martin Jambor <mjambor@suse.cz>
|
2017-01-23 Martin Jambor <mjambor@suse.cz>
|
||||||
|
|
||||||
PR ipa/79108
|
PR ipa/79108
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-O2 -fdump-ipa-cp-details" } */
|
||||||
|
|
||||||
|
volatile int cond;
|
||||||
|
int abs (int);
|
||||||
|
|
||||||
|
volatile int g;
|
||||||
|
|
||||||
|
int __attribute__((noinline, noclone))
|
||||||
|
take_address (int *p)
|
||||||
|
{
|
||||||
|
g = *p;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int __attribute__((noinline, noclone))
|
||||||
|
foo (int i)
|
||||||
|
{
|
||||||
|
if (i < 5)
|
||||||
|
__builtin_abort ();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int __attribute__((noinline, noclone))
|
||||||
|
bar (int j)
|
||||||
|
{
|
||||||
|
foo (~j);
|
||||||
|
foo (abs (j));
|
||||||
|
foo (j);
|
||||||
|
take_address (&j);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < 10; ++i)
|
||||||
|
bar (i);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* { dg-final { scan-ipa-dump-times "Setting value range of param 0 \\\[-10, 9\\\]" 1 "cp" } } */
|
Loading…
Reference in New Issue