This is the mail archive of the
mailing list for the GCC project.
Re: Switch optimization idea
- From: Steve Ellcey <steve dot ellcey at imgtec dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: Steve Ellcey <sellcey at imgtec dot com>, <gcc at gcc dot gnu dot org>
- Date: Fri, 22 Mar 2013 13:12:00 -0700
- Subject: Re: Switch optimization idea
- References: <ecf809e5-7e15-478f-a835-e0aea67a11eb at BAMAIL02 dot ba dot imgtec dot org> <514CAA45 dot 7050206 at redhat dot com>
On Fri, 2013-03-22 at 13:00 -0600, Jeff Law wrote:
> As others have pointed out, this is jump threading.
> The reason you're not seeing jump threading in the CoreMark test is the
> switch is inside a loop and threading a backedge is severely constrained.
> There's a BZ for this issue with a bit more state for this issue.
It took me a minute to map BZ to bugzilla, but I assume you mean there
is a bugzilla report with information on this issue, I'll look around to
see what I can find.
The example I gave was a simple case and ideally the duplicated code
(codeX) could have other edges leading into or out of it without that
preventing the jump threading. But it sounds like it does prevent it
with the current implementation of jump threading. Maybe it is just the
presence of a back edge that is preventing it. I will look more into
the GCC implementation and what constraints there are and why they
prevent its use in CoreMark.