diff options
author | Bin Cheng <bin.cheng@arm.com> | 2016-11-23 12:44:08 +0000 |
---|---|---|
committer | Bin Cheng <amker@gcc.gnu.org> | 2016-11-23 12:44:08 +0000 |
commit | b54819879e0518b3f1acc5242f9c1d86dd1b9e3c (patch) | |
tree | db5d291195258e1f26c23a15aa79a6d86dbc1de4 /gcc/tree-if-conv.c | |
parent | b8d89b03db5f212919e4571671ebb4f5f8b1e19d (diff) | |
download | gcc-b54819879e0518b3f1acc5242f9c1d86dd1b9e3c.zip gcc-b54819879e0518b3f1acc5242f9c1d86dd1b9e3c.tar.gz gcc-b54819879e0518b3f1acc5242f9c1d86dd1b9e3c.tar.bz2 |
fold-const.c (fold_cond_expr_with_comparison): Move simplification for A cmp C1 ? A : C2 to below, also simplify remaining code.
* fold-const.c (fold_cond_expr_with_comparison): Move simplification
for A cmp C1 ? A : C2 to below, also simplify remaining code.
* match.pd: Move and extend simplification from above to here:
(cond (cmp (convert1? x) c1) (convert2? x) c2) -> (minmax (x c)).
* tree-if-conv.c (ifcvt_follow_ssa_use_edges): New func.
(predicate_scalar_phi): Call fold_stmt using the new valueize func.
gcc/testsuite
* gcc.dg/fold-cond_expr-1.c: New test.
* gcc.dg/fold-condcmpconv-1.c: New test.
* gcc.dg/fold-condcmpconv-2.c: New test.
From-SVN: r242750
Diffstat (limited to 'gcc/tree-if-conv.c')
-rw-r--r-- | gcc/tree-if-conv.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index 13e12c6..5716deb 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -1749,6 +1749,14 @@ gen_phi_arg_condition (gphi *phi, vec<int> *occur, return cond; } +/* Local valueization callback that follows all-use SSA edges. */ + +static tree +ifcvt_follow_ssa_use_edges (tree val) +{ + return val; +} + /* Replace a scalar PHI node with a COND_EXPR using COND as condition. This routine can handle PHI nodes with more than two arguments. @@ -1844,6 +1852,8 @@ predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi) arg0, arg1); new_stmt = gimple_build_assign (res, rhs); gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT); + gimple_stmt_iterator new_gsi = gsi_for_stmt (new_stmt); + fold_stmt (&new_gsi, ifcvt_follow_ssa_use_edges); update_stmt (new_stmt); if (dump_file && (dump_flags & TDF_DETAILS)) |