aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-propagate.c
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2008-09-11 14:45:05 +0000
committerPaolo Bonzini <bonzini@gnu.org>2008-09-11 14:45:05 +0000
commiteb8b1356113bbcc71b4ef70f31c9146468bd0d6b (patch)
tree92b409e6b2cc1567926f357bf36f519f4895571f /gcc/tree-ssa-propagate.c
parente23f8778290c815d8713e64dd2f0807c0ad8011f (diff)
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@140288 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-propagate.c')
-rw-r--r--gcc/tree-ssa-propagate.c30
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);
}
}