summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index eeae4bfcd35..996296b4e36 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -646,6 +646,7 @@ static ccp_lattice_t
likely_value (gimple stmt)
{
bool has_constant_operand, has_undefined_operand, all_undefined_operands;
+ bool has_nsa_operand;
tree use;
ssa_op_iter iter;
unsigned i;
@@ -668,6 +669,7 @@ likely_value (gimple stmt)
has_constant_operand = false;
has_undefined_operand = false;
all_undefined_operands = true;
+ has_nsa_operand = false;
FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE)
{
ccp_prop_value_t *val = get_value (use);
@@ -679,6 +681,10 @@ likely_value (gimple stmt)
if (val->lattice_val == CONSTANT)
has_constant_operand = true;
+
+ if (SSA_NAME_IS_DEFAULT_DEF (use)
+ || !prop_simulate_again_p (SSA_NAME_DEF_STMT (use)))
+ has_nsa_operand = true;
}
/* There may be constants in regular rhs operands. For calls we
@@ -751,8 +757,10 @@ likely_value (gimple stmt)
/* We do not consider virtual operands here -- load from read-only
memory may have only VARYING virtual operands, but still be
- constant. */
+ constant. Also we can combine the stmt with definitions from
+ operands whose definitions are not simulated again. */
if (has_constant_operand
+ || has_nsa_operand
|| gimple_references_memory_p (stmt))
return CONSTANT;