diff options
author | Richard Biener <rguenther@suse.de> | 2016-03-03 09:12:53 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-03-03 09:12:53 +0000 |
commit | a75f5e30cc27568bbc2bc0629425598e89bf9059 (patch) | |
tree | 05f432bea9dada8406010e5ee06973c6c266c6bb /gcc/tree-vrp.c | |
parent | 0a67ef4c4de7bf55d3ef3c7bc61a9480e0d213bd (diff) | |
download | gcc-a75f5e30cc27568bbc2bc0629425598e89bf9059.zip gcc-a75f5e30cc27568bbc2bc0629425598e89bf9059.tar.gz gcc-a75f5e30cc27568bbc2bc0629425598e89bf9059.tar.bz2 |
re PR tree-optimization/55936 (Missed VRP optimization)
2016-03-03 Richard Biener <rguenther@suse.de>
PR tree-optimization/55936
* tree-vrp.c (compare_name_with_value): Add use_equiv_p
parameter and guard unsafe equivalence use.
(vrp_evaluate_conditional_warnv_with_ops): Always use
safe equivalences but not via the quadratic compare_names
helper.
* gcc.dg/tree-ssa/vrp06.c: Remove XFAIL.
From-SVN: r233928
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r-- | gcc/tree-vrp.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index a11635d..b5654c5 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -7161,7 +7161,7 @@ get_vr_for_comparison (int i) static tree compare_name_with_value (enum tree_code comp, tree var, tree val, - bool *strict_overflow_p) + bool *strict_overflow_p, bool use_equiv_p) { bitmap_iterator bi; unsigned i; @@ -7196,6 +7196,11 @@ compare_name_with_value (enum tree_code comp, tree var, tree val, EXECUTE_IF_SET_IN_BITMAP (e, 0, i, bi) { + if (! use_equiv_p + && ! SSA_NAME_IS_DEFAULT_DEF (ssa_name (i)) + && prop_simulate_again_p (SSA_NAME_DEF_STMT (ssa_name (i)))) + continue; + equiv_vr = get_vr_for_comparison (i); sop = false; t = compare_range_with_value (comp, &equiv_vr, val, &sop); @@ -7381,24 +7386,21 @@ vrp_evaluate_conditional_warnv_with_ops (enum tree_code code, tree op0, && !POINTER_TYPE_P (TREE_TYPE (op0))) return NULL_TREE; - if (use_equiv_p) - { - if (only_ranges - && (ret = vrp_evaluate_conditional_warnv_with_ops_using_ranges - (code, op0, op1, strict_overflow_p))) - return ret; - *only_ranges = false; - if (TREE_CODE (op0) == SSA_NAME && TREE_CODE (op1) == SSA_NAME) - return compare_names (code, op0, op1, strict_overflow_p); - else if (TREE_CODE (op0) == SSA_NAME) - return compare_name_with_value (code, op0, op1, strict_overflow_p); - else if (TREE_CODE (op1) == SSA_NAME) - return (compare_name_with_value - (swap_tree_comparison (code), op1, op0, strict_overflow_p)); - } - else - return vrp_evaluate_conditional_warnv_with_ops_using_ranges (code, op0, op1, - strict_overflow_p); + if ((ret = vrp_evaluate_conditional_warnv_with_ops_using_ranges + (code, op0, op1, strict_overflow_p))) + return ret; + if (only_ranges) + *only_ranges = false; + /* Do not use compare_names during propagation, it's quadratic. */ + if (TREE_CODE (op0) == SSA_NAME && TREE_CODE (op1) == SSA_NAME + && use_equiv_p) + return compare_names (code, op0, op1, strict_overflow_p); + else if (TREE_CODE (op0) == SSA_NAME) + return compare_name_with_value (code, op0, op1, + strict_overflow_p, use_equiv_p); + else if (TREE_CODE (op1) == SSA_NAME) + return compare_name_with_value (swap_tree_comparison (code), op1, op0, + strict_overflow_p, use_equiv_p); return NULL_TREE; } |