This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix PR middle-end/57370
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Easwaran Raman <eraman at google dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 30 Aug 2013 19:02:49 +0200
- Subject: Re: Fix PR middle-end/57370
- Authentication-results: sourceware.org; auth=none
- References: <CAPK5YPbNvp9g-9O=DUb06S3yNEvXiBrYeTbbsW2cDJuwd2_UXQ at mail dot gmail dot com> <CAPK5YPaXwtv6O41hgk4gdfdU0H2d=H3Ac5YUJsmYDQWLKc7VGg at mail dot gmail dot com> <CAPK5YPYXHtxs=+LpJNeZuKU+hmx80zjG1qQgeetxLt6qtGBSJA at mail dot gmail dot com> <CAFiYyc1_zfQzzJZQpTh+di=Q1RVrEMXnNtksTRb9UaGeDZCjvQ at mail dot gmail dot com> <CAPK5YPY4f8zr6O4h+FKs9_9Wn5-LRzBc0CQp742nQ9gF3bM0Sg at mail dot gmail dot com> <CAFiYyc2uR6G1UUJYGfa-s8Tz08b_cfw6cYJ9g8bG4qUZPEVcxw at mail dot gmail dot com> <CAPK5YPYZLSBNED3+7c802U=ixU2EUJhQu8yOzyHTy6P8czR=yQ at mail dot gmail dot com> <20130830162611 dot GR21876 at tucnak dot zalov dot cz> <CAPK5YPZp8zw6a6aJAD5nBMh_fZ3qFAu6pzjykRR9E9vCpVMJbg at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Aug 30, 2013 at 09:49:59AM -0700, Easwaran Raman wrote:
> Yes, this is pretty much what I was proposing. The current
> implementation doesn't rely on UIDs being unique - they only have to
> be monotonically non-decreasing. So, when a UID of 0 is encountered,
> go up till a non-zero UID is found and then go down and assign this
> non-zero UID. This effectively implies that each UID-0 stmt is visited
> at most twice. I don't think we need to check if I see more than
> certain number of UID-0 stmts and redo the entire BB.
Sure, renumbering the entire BB would be only for compile time reasons;
if you end up with a huge bb where 90% of stmts will have the same UID,
it is as if you weren't using UIDs at all and always walked the entire BB
to find out what stmt precedes what. You could spend a lot of time in
appears_later_in_bb.
Looking at the code, couple of nits:
return ((bb_a == bb_b && gimple_uid (a) < gimple_uid (b))
extra space before <.
gsi_next (&gsi);
if (gsi_end_p (gsi))
return stmt1;
for (; !gsi_end_p (gsi); gsi_next (&gsi))
{
...
}
return stmt1;
Why not just for (gsi_next (&gsi); !gsi_end_p (gsi); gsi_next (&gsi)) ?
The extra if (gsi_end_p (gsi)) return stmt1; doesn't make any sense
when the loop does exactly that too.
And for the debug stmts, are you sure you are resetting only those debug
stmts which you have to reset? I mean, if there are say debug stmts using
the SSA_NAME in other bb, it doesn't need to be reset (unless you reuse
the same SSA_NAME for something else), and the compiler even has code
to reconstruct SSA_NAMEs that have been removed, but were still referenced
in debug stmts, using expressions in debug stmts and debug temporaries.
Jakub