aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-uncprop.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2016-01-15 15:32:05 -0700
committerJeff Law <law@gcc.gnu.org>2016-01-15 15:32:05 -0700
commit40c43acacc1765416278e6636c20c5e3a78a7384 (patch)
tree0c5e0c93ef87ace7d5ef512867efe2303ef79439 /gcc/tree-ssa-uncprop.c
parentcebeb718fed641f5c6b093e487c5e93c9b41ce02 (diff)
downloadgcc-40c43acacc1765416278e6636c20c5e3a78a7384.zip
gcc-40c43acacc1765416278e6636c20c5e3a78a7384.tar.gz
gcc-40c43acacc1765416278e6636c20c5e3a78a7384.tar.bz2
re PR tree-optimization/69270 (DOM should exploit range information to create more equivalences)
PR tree-optimization/69270 * tree-ssanames.c (ssa_name_has_boolean_range): Moved here from tree-ssa-dom.c. Improve test for [0..1] ranve from VRP. * tree-ssa-dom.c (ssa_name_has_boolean_range): Remove. * tree-ssanames.h (ssa_name_has_boolean_range): Prototype. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Use ssa_name_has_boolean_range and constant_boolean_node. PR tree-optimization/69270 * gcc.dg/tree-ssa/pr69270-2.c: New test. * gcc.dg/tree-ssa/pr69270-3.c: New test. From-SVN: r232453
Diffstat (limited to 'gcc/tree-ssa-uncprop.c')
-rw-r--r--gcc/tree-ssa-uncprop.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
index 4b57578..307bb1f 100644
--- a/gcc/tree-ssa-uncprop.c
+++ b/gcc/tree-ssa-uncprop.c
@@ -94,23 +94,26 @@ associate_equivalences_with_edges (void)
can record an equivalence for OP0 rather than COND. */
if (TREE_CODE (op0) == SSA_NAME
&& !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op0)
- && TREE_CODE (TREE_TYPE (op0)) == BOOLEAN_TYPE
+ && ssa_name_has_boolean_range (op0)
&& is_gimple_min_invariant (op1))
{
+ tree true_val = constant_boolean_node (true, TREE_TYPE (op0));
+ tree false_val = constant_boolean_node (false,
+ TREE_TYPE (op0));
if (code == EQ_EXPR)
{
equivalency = XNEW (struct edge_equivalency);
equivalency->lhs = op0;
equivalency->rhs = (integer_zerop (op1)
- ? boolean_false_node
- : boolean_true_node);
+ ? false_val
+ : true_val);
true_edge->aux = equivalency;
equivalency = XNEW (struct edge_equivalency);
equivalency->lhs = op0;
equivalency->rhs = (integer_zerop (op1)
- ? boolean_true_node
- : boolean_false_node);
+ ? true_val
+ : false_val);
false_edge->aux = equivalency;
}
else
@@ -118,15 +121,15 @@ associate_equivalences_with_edges (void)
equivalency = XNEW (struct edge_equivalency);
equivalency->lhs = op0;
equivalency->rhs = (integer_zerop (op1)
- ? boolean_true_node
- : boolean_false_node);
+ ? true_val
+ : false_val);
true_edge->aux = equivalency;
equivalency = XNEW (struct edge_equivalency);
equivalency->lhs = op0;
equivalency->rhs = (integer_zerop (op1)
- ? boolean_false_node
- : boolean_true_node);
+ ? false_val
+ : true_val);
false_edge->aux = equivalency;
}
}