diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2008-09-11 14:45:05 +0000 |
---|---|---|
committer | Paolo Bonzini <bonzini@gcc.gnu.org> | 2008-09-11 14:45:05 +0000 |
commit | 308216549297c41fb602dced560fa1ed8af0f8f6 (patch) | |
tree | 92b409e6b2cc1567926f357bf36f519f4895571f /gcc/tree-ssa-propagate.c | |
parent | cf9757477e367cf9ab4e8dae6489dcd09178033e (diff) | |
download | gcc-308216549297c41fb602dced560fa1ed8af0f8f6.tar.gz |
dojump.c (do_jump): Move below.
2008-09-11 Paolo Bonzini <bonzini@gnu.org>
* dojump.c (do_jump) [BIT_AND_EXPR]: Move below. Fall through to
TRUTH_AND_EXPR for boolean (1-bit precision) expressions.
(do_jump) [BIT_IOR_EXPR]: Compile as TRUTH_OR_EXPR.
* tree-flow.h (simplify_stmt_using_ranges): Accept a GSI, return a bool.
* tree-ssa-propagate.c (substitute_and_fold): Pass a GSI to
VRP's simplify_stmt_using_ranges. Do simplify_stmt_using_ranges
before finalizing the changes.
* tree-vrp.c (extract_range_from_binary_expr): Add limited support
for BIT_IOR_EXPR.
(simplify_truth_ops_using_ranges): New.
(simplify_div_or_mod_using_ranges, simplify_abs_using_ranges,
simplify_cond_using_ranges, simplify_switch_using_ranges): Return
whether a simplification was made.
(simplify_stmt_using_ranges): Ditto, and accept a GSI. For GS_ASSIGN,
use a switch statement and also call simplify_truth_ops_using_ranges.
testsuite:
2008-09-11 Paolo Bonzini <bonzini@gnu.org>
* gcc.dg/tree-ssa/vrp47.c: New.
* gcc.target/i386/andor-2.c: New.
From-SVN: r140288
Diffstat (limited to 'gcc/tree-ssa-propagate.c')
-rw-r--r-- | gcc/tree-ssa-propagate.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index 4c246e679fe..86bc2381214 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -1098,6 +1098,7 @@ substitute_and_fold (prop_value_t *prop_value, bool use_ranges_p) { bool did_replace; gimple stmt = gsi_stmt (i); + gimple old_stmt; enum gimple_code code = gimple_code (stmt); /* Ignore ASSERT_EXPRs. They are used by VRP to generate @@ -1162,12 +1163,24 @@ substitute_and_fold (prop_value_t *prop_value, bool use_ranges_p) && !did_replace) did_replace |= replace_uses_in (stmt, prop_value); - /* If we made a replacement, fold and cleanup the statement. */ + /* If we made a replacement, fold the statement. */ + + old_stmt = stmt; if (did_replace) - { - gimple old_stmt = stmt; + fold_stmt (&i); + + /* Some statements may be simplified using ranges. For + example, division may be replaced by shifts, modulo + replaced with bitwise and, etc. Do this after + substituting constants, folding, etc so that we're + presented with a fully propagated, canonicalized + statement. */ + if (use_ranges_p) + did_replace |= simplify_stmt_using_ranges (&i); - fold_stmt (&i); + /* Now cleanup. */ + if (did_replace) + { stmt = gsi_stmt (i); /* If we cleaned up EH information from the statement, @@ -1207,15 +1220,6 @@ substitute_and_fold (prop_value_t *prop_value, bool use_ranges_p) fprintf (dump_file, "Not folded\n"); } - /* Some statements may be simplified using ranges. For - example, division may be replaced by shifts, modulo - replaced with bitwise and, etc. Do this after - substituting constants, folding, etc so that we're - presented with a fully propagated, canonicalized - statement. */ - if (use_ranges_p) - simplify_stmt_using_ranges (stmt); - gsi_prev (&i); } } |