aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-phiopt.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-12-09 23:52:25 +0100
committerJakub Jelinek <jakub@redhat.com>2020-12-09 23:52:25 +0100
commit7d9767cb8eea0f21c5b23b0183c53840e0433397 (patch)
treec114c4644ce9bacfe054ad40582ff51a98516420 /gcc/tree-ssa-phiopt.c
parentef33047a8b93d416f08f3f640dd65f3887fb05c1 (diff)
downloadgcc-7d9767cb8eea0f21c5b23b0183c53840e0433397.zip
gcc-7d9767cb8eea0f21c5b23b0183c53840e0433397.tar.gz
gcc-7d9767cb8eea0f21c5b23b0183c53840e0433397.tar.bz2
phiopt: Fix up two_value_replacement BOOLEAN_TYPE handling for Ada [PR98188]
For Ada with LTO, boolean_{false,true}_node can be 1-bit precision boolean, while TREE_TYPE (lhs) can be 8-bit precision boolean and thus we can end up with wide_int mismatches. This patch for non-VR_RANGE just use VARYING min/max manually. The min + 1 != max check will then do the rest. 2020-12-09 Jakub Jelinek <jakub@redhat.com> PR bootstrap/98188 * tree-ssa-phiopt.c (two_value_replacement): Don't special case BOOLEAN_TYPEs for ranges, instead if get_range_info doesn't return VR_RANGE, set min/max to wi::min/max_value.
Diffstat (limited to 'gcc/tree-ssa-phiopt.c')
-rw-r--r--gcc/tree-ssa-phiopt.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 21b88c0..3d40f07 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -658,13 +658,13 @@ two_value_replacement (basic_block cond_bb, basic_block middle_bb,
return false;
wide_int min, max;
- if (TREE_CODE (TREE_TYPE (lhs)) == BOOLEAN_TYPE)
+ if (get_range_info (lhs, &min, &max) != VR_RANGE)
{
- min = wi::to_wide (boolean_false_node);
- max = wi::to_wide (boolean_true_node);
+ int prec = TYPE_PRECISION (TREE_TYPE (lhs));
+ signop sgn = TYPE_SIGN (TREE_TYPE (lhs));
+ min = wi::min_value (prec, sgn);
+ max = wi::max_value (prec, sgn);
}
- else if (get_range_info (lhs, &min, &max) != VR_RANGE)
- return false;
if (min + 1 != max
|| (wi::to_wide (rhs) != min
&& wi::to_wide (rhs) != max))