aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-04-16 07:55:57 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-04-16 07:55:57 +0000
commit8a474dc5d7d152653e90e960eff1852d1c7ff914 (patch)
tree649c5ed590a9bcfcc0ac37c15b11b36688be346a /gcc/tree-ssa-ccp.c
parent8d1cac076c9ac75a81f15e2249ff9a92a0278516 (diff)
downloadgcc-8a474dc5d7d152653e90e960eff1852d1c7ff914.zip
gcc-8a474dc5d7d152653e90e960eff1852d1c7ff914.tar.gz
gcc-8a474dc5d7d152653e90e960eff1852d1c7ff914.tar.bz2
tree-ssa-ccp.c (likely_value): See if we have operands that are marked as never simulate again and return...
2015-04-16 Richard Biener <rguenther@suse.de> * tree-ssa-ccp.c (likely_value): See if we have operands that are marked as never simulate again and return CONSTANT in this case. * tree-ssa-propagate.c (simulate_stmt): Mark stmts that do not have any operands that will be simulated again as not being simulated again. * gcc.dg/tree-ssa/ssa-ccp-36.c: New testcase. * gcc.dg/tree-ssa/pr37508.c: Adjust. * gfortran.dg/reassoc_6.f: Remove XFAIL. From-SVN: r222141
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 eeae4bf..996296b 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;