This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/84321] [8 Regression] ice in intersect_range_with_nonzero_bits, at tree-vrp.c:213
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 12 Feb 2018 10:34:16 +0000
- Subject: [Bug tree-optimization/84321] [8 Regression] ice in intersect_range_with_nonzero_bits, at tree-vrp.c:213
- Auto-submitted: auto-generated
- References: <bug-84321-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84321
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|SUSPENDED |ASSIGNED
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This seems to fix it. But as I said, the asserts still need to go.
--- gcc/tree-ssanames.c.jj 2018-01-30 12:30:27.678359900 +0100
+++ gcc/tree-ssanames.c 2018-02-12 11:32:51.768829381 +0100
@@ -464,6 +464,21 @@ set_nonzero_bits (tree name, const wide_
}
range_info_def *ri = SSA_NAME_RANGE_INFO (name);
ri->set_nonzero_bits (mask);
+ /* If it is a range, try to improve min/max from nonzero_bits. */
+ if (SSA_NAME_RANGE_TYPE (name) == VR_RANGE)
+ {
+ wide_int msk = ri->get_nonzero_bits ();
+ wide_int min = wi::round_up_for_mask (ri->get_min (), msk);
+ wide_int max = wi::round_down_for_mask (ri->get_max (), msk);
+ signop sgn = TYPE_SIGN (TREE_TYPE (name));
+ if (wi::le_p (min, max, sgn)
+ && wi::le_p (min, ri->get_max (), sgn)
+ && wi::le_p (ri->get_min (), max, sgn))
+ {
+ ri->set_min (min);
+ ri->set_max (max);
+ }
+ }
}
/* Return a widest_int with potentially non-zero bits in SSA_NAME