[PATCH] fix PR opt/2391 (mostly ARM)
Richard Henderson
rth@redhat.com
Sat Jan 25 21:36:00 GMT 2003
On Fri, Jan 10, 2003 at 10:56:43AM -0800, Adam Nemet wrote:
> +static unsigned HOST_WIDE_INT
> +nonzero_bits1 (x, mode, known_x, known_x_ret)
> + rtx x;
> + enum machine_mode mode;
> + rtx known_x;
> + unsigned HOST_WIDE_INT known_x_ret;
> +{
> + if (x == known_x)
> + return known_x_ret;
I believe you should be using rtx_equal_p here instead of pointer
equality. Similarly with the other comparisons below.
I also believe that you should be checking MODE against the mode
that was used for KNOWN_X as well. This means passing around a
third cache value as well.
I considered whether it might be useful to have a more general
lookaside cache for this. I'm guessing not, since the memory
allocation overhead would tend to dominate the common case.
> -nonzero_bits (x, mode)
> +nonzero_bits2 (x, mode, known_x, known_x_ret)
> rtx x;
> enum machine_mode mode;
> + rtx known_x;
> + unsigned HOST_WIDE_INT known_x_ret;
> {
> unsigned HOST_WIDE_INT nonzero = GET_MODE_MASK (mode);
> unsigned HOST_WIDE_INT inner_nz;
> @@ -8156,7 +8218,7 @@ nonzero_bits (x, mode)
> && GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT
> && GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (GET_MODE (x)))
> {
> - nonzero &= nonzero_bits (x, GET_MODE (x));
> + nonzero &= nonzero_bits1 (x, GET_MODE (x), known_x, known_x_ret);
You might consider redefining nonzero_bits for the duration of this
function. It would avoid cluttering the text, and allow you to
easily add the third cache argument.
> @@ -11325,7 +11459,45 @@ update_table_tick (x)
> + /* If x0 and x1 are identical then there is no need to
> + process x0. */
> + if (x0 == x1)
> + break;
> +
> + /* If x0 is identical to a subexpression of x1 then while
> + processing x1, x0 has already been processed. Thus we
> + are done with x. */
> + if ((GET_RTX_CLASS (GET_CODE (x1)) == '2'
> + || GET_RTX_CLASS (GET_CODE (x1)) == 'c')
> + && (x0 == XEXP (x1, 0) || x0 == XEXP (x1, 1)))
> + break;
> +
> + /* If x1 is identical to a subexpression of x0 then we
> + still have to process the rest of x0. */
> + if ((GET_RTX_CLASS (GET_CODE (x0)) == '2'
> + || GET_RTX_CLASS (GET_CODE (x0)) == 'c')
> + && (x1 == XEXP (x0, 0) || x1 == XEXP (x0, 1)))
Um, how often do these trigger?
r~
More information about the Gcc-patches
mailing list