This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Problem with tree pass pre
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: shmeel gutl <shmeelgutl at shmuelhome dot mine dot nu>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Mon, 31 Aug 2015 13:19:15 +0200
- Subject: Re: Problem with tree pass pre
- Authentication-results: sourceware.org; auth=none
- References: <55E3DD37 dot 6060205 at shmuelhome dot mine dot nu>
On Mon, Aug 31, 2015 at 6:51 AM, shmeel gutl
<shmeelgutl@shmuelhome.mine.nu> wrote:
> When dealing with an array with known values, pre will evaluate the first
> iteration of a loop over the elements. The code generator with then jump
> into the loop. This is at best increasing the size of the code. It also
> creates inferior code when the hardware supports zero overhead loops. The
> attached code demonstrates the difference between an unknown array and a
> known array. The loop size has been picked large enough for cunrolli to not
> fully unroll the loop. The problem did not exist in gcc 4.8.
I think you were just lucky with GCC 4.8 - the issue is present since forever.
Basically it's because we treat a constant as available. So PRE might end
up rotating the loop, inserting the 2nd iteration on the latch edge.
Unfortunately this transform sometimes improves code-gen, it would be
quite simple to disallow this kind of transform generally though.
Richard.
>
>