diff options
author | Richard Biener <rguenther@suse.de> | 2015-10-19 13:58:27 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2015-10-19 13:58:27 +0000 |
commit | 4534c2032ba23be0a1f6b74ea2e23bc94df0cb81 (patch) | |
tree | ab6e2c78aa78e165e6c5f5307a23b2f3a4fa5fff /gcc/gimple-fold.c | |
parent | 1c6e3c3e2ce560e555ba7d75a22179757a3c6489 (diff) | |
download | gcc-4534c2032ba23be0a1f6b74ea2e23bc94df0cb81.zip gcc-4534c2032ba23be0a1f6b74ea2e23bc94df0cb81.tar.gz gcc-4534c2032ba23be0a1f6b74ea2e23bc94df0cb81.tar.bz2 |
gimple-fold.c (gimple_phi_nonnegative_warnv_p): New function.
2015-10-19 Richard Biener <rguenther@suse.de>
* gimple-fold.c (gimple_phi_nonnegative_warnv_p): New function.
(gimple_stmt_nonnegative_warnv_p): Use it.
* match.pd (CPROJ): New operator list.
(cproj (complex ...)): Move simplifications from ...
* builtins.c (fold_builtin_cproj): ... here.
* gcc.dg/torture/builtin-cproj-1.c: Skip for -O0.
From-SVN: r228970
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r-- | gcc/gimple-fold.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 2e5942a..85ff018 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -6224,6 +6224,24 @@ gimple_call_nonnegative_warnv_p (gimple *stmt, bool *strict_overflow_p, strict_overflow_p, depth); } +/* Return true if return value of call STMT is known to be non-negative. + If the return value is based on the assumption that signed overflow is + undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change + *STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. */ + +static bool +gimple_phi_nonnegative_warnv_p (gimple *stmt, bool *strict_overflow_p, + int depth) +{ + for (unsigned i = 0; i < gimple_phi_num_args (stmt); ++i) + { + tree arg = gimple_phi_arg_def (stmt, i); + if (!tree_single_nonnegative_warnv_p (arg, strict_overflow_p, depth + 1)) + return false; + } + return true; +} + /* Return true if STMT is known to compute a non-negative value. If the return value is based on the assumption that signed overflow is undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change @@ -6241,6 +6259,9 @@ gimple_stmt_nonnegative_warnv_p (gimple *stmt, bool *strict_overflow_p, case GIMPLE_CALL: return gimple_call_nonnegative_warnv_p (stmt, strict_overflow_p, depth); + case GIMPLE_PHI: + return gimple_phi_nonnegative_warnv_p (stmt, strict_overflow_p, + depth); default: return false; } |