cleaned up code to get around tree-vrp issue. added some code that
richard is going to play with to see how hard it would be to clean up
rtl constants.
kenny
Index: gcc/wide-int.cc
===================================================================
--- gcc/wide-int.cc (revision 201968)
+++ gcc/wide-int.cc (working copy)
@@ -171,6 +171,12 @@ wide_int_ro::from_rtx (const rtx_mode_t
case CONST_INT:
result.val[0] = INTVAL (x);
result.len = 1;
+
+#if 0
+ if (prec != HOST_BITS_PER_WIDE_INT)
+ gcc_assert (result.val[0] == sext_hwi (result.val[0], prec));
+#endif
+
#ifdef DEBUG_WIDE_INT
debug_wh ("wide_int:: %s = from_rtx ("HOST_WIDE_INT_PRINT_HEX")\n",
result, INTVAL (x));
Index: gcc/wide-int.h
===================================================================
--- gcc/wide-int.h (revision 201968)
+++ gcc/wide-int.h (working copy)
@@ -1843,7 +1843,6 @@ wide_int_ro::zforce_to_size (unsigned in
inline HOST_WIDE_INT
wide_int_ro::sign_mask () const
{
- int i = len - 1;
if (precision < HOST_BITS_PER_WIDE_INT)
{
/* We don't allow a int:0 inside a struct to get this far,
@@ -1853,14 +1852,13 @@ wide_int_ro::sign_mask () const
>> (HOST_BITS_PER_WIDE_INT - 1));
}
- /* VRP appears to be badly broken and this is a very ugly fix. */
- if (i >= 0)
- return val[i] >> (HOST_BITS_PER_WIDE_INT - 1);
-
- gcc_unreachable ();
-#if 0
- return val[len - 1] >> (HOST_BITS_PER_WIDE_INT - 1);
-#endif
+ /* TREE_VRP is not able to see that it is not possible for len to be
+ 0. So without this test, it warns about this which causes
+ bootstrap failures. */
+ if (len < 1)
+ gcc_unreachable ();
+ else
+ return val[len - 1] >> (HOST_BITS_PER_WIDE_INT - 1);
}
/* Return THIS & C. */