diff options
author | Ian Lance Taylor <iant@golang.org> | 2021-10-07 15:28:36 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2021-10-07 15:28:36 -0700 |
commit | 0b6b70a0733672600644c8df96942cda5bf86d3d (patch) | |
tree | 9a1fbd7f782c54df55ab225ed1be057e3f3b0b8a /gcc/tree-ssanames.c | |
parent | a5b5cabc91c38710adbe5c8a2b53882abe994441 (diff) | |
parent | fba228e259dd5112851527f2dbb62c5601100985 (diff) | |
download | gcc-0b6b70a0733672600644c8df96942cda5bf86d3d.zip gcc-0b6b70a0733672600644c8df96942cda5bf86d3d.tar.gz gcc-0b6b70a0733672600644c8df96942cda5bf86d3d.tar.bz2 |
Merge from trunk revision fba228e259dd5112851527f2dbb62c5601100985.
Diffstat (limited to 'gcc/tree-ssanames.c')
-rw-r--r-- | gcc/tree-ssanames.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c index 2165ad7..f427c5a 100644 --- a/gcc/tree-ssanames.c +++ b/gcc/tree-ssanames.c @@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa.h" #include "cfgloop.h" #include "tree-scalar-evolution.h" +#include "value-query.h" /* Rewriting a function into SSA form can create a huge number of SSA_NAMEs, many of which may be thrown away shortly after their creation if jumps @@ -484,7 +485,7 @@ get_nonzero_bits (const_tree name) This can be because it is a boolean type, any unsigned integral type with a single bit of precision, or has known range of [0..1] - via VRP analysis. */ + via range analysis. */ bool ssa_name_has_boolean_range (tree op) @@ -502,12 +503,20 @@ ssa_name_has_boolean_range (tree op) return true; /* An integral type with more precision, but the object - only takes on values [0..1] as determined by VRP + only takes on values [0..1] as determined by range analysis. */ if (INTEGRAL_TYPE_P (TREE_TYPE (op)) - && (TYPE_PRECISION (TREE_TYPE (op)) > 1) - && wi::eq_p (get_nonzero_bits (op), 1)) - return true; + && (TYPE_PRECISION (TREE_TYPE (op)) > 1)) + { + int_range<2> onezero (build_zero_cst (TREE_TYPE (op)), + build_one_cst (TREE_TYPE (op))); + int_range<2> r; + if (get_range_query (cfun)->range_of_expr (r, op) && r == onezero) + return true; + + if (wi::eq_p (get_nonzero_bits (op), 1)) + return true; + } return false; } |