summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-reassoc.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-23 14:21:46 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-23 14:21:46 +0000
commit4c0d6cf74a85d567ad2bcf57ae51646ee2fedd20 (patch)
tree3588f3e5d92d09b275560f857be2669c3ba82fcb /gcc/tree-ssa-reassoc.c
parent96188d906779ec71bfb51572bab4ec8a4c094f4b (diff)
downloadgcc-4c0d6cf74a85d567ad2bcf57ae51646ee2fedd20.tar.gz
PR tree-optimization/59154
* tree-ssa-reassoc.c (maybe_optimize_range_tests): When changing rhs1 of a cast and new_op is invariant, fold_convert it. * tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Only call simplify_conversion_from_bitmask if rhs1 is a SSA_NAME. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205307 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-reassoc.c')
-rw-r--r--gcc/tree-ssa-reassoc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 9daf28f6d07..7145559d697 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -2935,9 +2935,15 @@ maybe_optimize_range_tests (gimple stmt)
tree new_lhs = make_ssa_name (TREE_TYPE (lhs), NULL);
enum tree_code rhs_code
= gimple_assign_rhs_code (cast_stmt);
- gimple g
- = gimple_build_assign_with_ops (rhs_code, new_lhs,
- new_op, NULL_TREE);
+ gimple g;
+ if (is_gimple_min_invariant (new_op))
+ {
+ new_op = fold_convert (TREE_TYPE (lhs), new_op);
+ g = gimple_build_assign (new_lhs, new_op);
+ }
+ else
+ g = gimple_build_assign_with_ops (rhs_code, new_lhs,
+ new_op, NULL_TREE);
gimple_stmt_iterator gsi = gsi_for_stmt (cast_stmt);
gimple_set_uid (g, gimple_uid (cast_stmt));
gimple_set_visited (g, true);