From: Richard Biener Date: Thu, 2 Jul 2015 07:37:35 +0000 (+0000) Subject: tree-ssa-dom.c (build_and_record_new_cond): Add optional parameter to record a condit... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a003896684c5b8269eed6b472c2b35fe238294bc;p=gcc.git tree-ssa-dom.c (build_and_record_new_cond): Add optional parameter to record a condition that is false. 2015-07-02 Richard Biener * tree-ssa-dom.c (build_and_record_new_cond): Add optional parameter to record a condition that is false. (record_conditions): When recording an extra NE_EXPR that is true also record a EQ_EXPR that is false. * gcc.dg/tree-ssa/ssa-dom-cse-4.c: New testcase. From-SVN: r225299 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c9c3c209d92..90d997fdcb1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-07-02 Richard Biener + + * tree-ssa-dom.c (build_and_record_new_cond): Add optional + parameter to record a condition that is false. + (record_conditions): When recording an extra NE_EXPR that is + true also record a EQ_EXPR that is false. + 2015-07-02 Bin Cheng * tree-ssa-loop-ivopts.c (struct ivopts_data): New field iv_obstack. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f6903b0f741..789f44e8e37 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-07-02 Richard Biener + + * gcc.dg/tree-ssa/ssa-dom-cse-4.c: New testcase. + 2015-07-01 H.J. Lu * gcc.target/i386/mpx/pr66568.c (exit): New prototype. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-4.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-4.c new file mode 100644 index 00000000000..cc9dde95255 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-4.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-optimized" } */ + +extern void abort (void); + +unsigned int +foo (unsigned int x, unsigned int y) +{ + unsigned int z; + + if (x >= y) + return 1; + + if (y == x) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-not "abort" "optimized" } } */ diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index e45b78c411a..698f78a5239 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -813,7 +813,8 @@ free_all_edge_infos (void) static void build_and_record_new_cond (enum tree_code code, tree op0, tree op1, - vec *p) + vec *p, + bool val = true) { cond_equivalence c; struct hashable_expr *cond = &c.cond; @@ -826,7 +827,7 @@ build_and_record_new_cond (enum tree_code code, cond->ops.binary.opnd0 = op0; cond->ops.binary.opnd1 = op1; - c.value = boolean_true_node; + c.value = val ? boolean_true_node : boolean_false_node; p->safe_push (c); } @@ -865,6 +866,8 @@ record_conditions (struct edge_info *edge_info, tree cond, tree inverted) op0, op1, &edge_info->cond_equivalences); build_and_record_new_cond (NE_EXPR, op0, op1, &edge_info->cond_equivalences); + build_and_record_new_cond (EQ_EXPR, op0, op1, + &edge_info->cond_equivalences, false); break; case GE_EXPR: