This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: A loop.c patch
- To: "H.J. Lu" <hjl at lucon dot org>, egcs-patches at cygnus dot com
- Subject: Re: A loop.c patch
- From: Richard Henderson <rth at cygnus dot com>
- Date: Wed, 1 Jul 1998 13:35:26 -0700
- References: <m0yrG4a-000266C@ocean.lucon.org>
- Reply-To: Richard Henderson <rth at cygnus dot com>
On Tue, Jun 30, 1998 at 11:08:52PM -3100, H.J. Lu wrote:
> Here is a loop patch and a testcase. I have reported it earlier with
> my analysis.
You gave to test case, and I could not find the post in which
you reported it earlier -- a reference would have been nice.
The patch is certainly not correct.
> + /* We need to check if the memory referenced by SET_SRC (pat) is
> + set or not before since SET_SRC (pat) may be used to reference
> + that memory later. */
> + if (GET_CODE (pat) != SET)
> + pat = single_set (pat);
> +
> + if (!pat || !rtx_equal_p (SET_DEST (pat), x)
> + || rtx_equal_p (SET_SRC (pat), x)
> + || GET_CODE (x) != REG)
> + return;
> +
> + for (i = 0; i < loop_store_mems_idx; i++)
> + if (rtx_equal_p (XEXP (loop_store_mems[i], 0), SET_SRC (pat)))
> + {
> + loop_store_mems[loop_store_mems_idx++]
> + = gen_rtx_MEM (GET_MODE (loop_store_mems[i]), x);
Meaning that if I have
(set (mem:SI (reg:DI 1)) (something))
(set (reg:SI 2) (mem:SI (reg:DI 1)))
that (mem:SI (reg:SI 2)) will be recorded in loop_store_mems?!?
You've just completely bollixed invariant_p, as far as I can tell,
which may well have hidden the actual problem.
r~