Problem with tree pass pre

shmeel gutl shmeelgutl@shmuelhome.mine.nu
Tue Sep 1 05:47:00 GMT 2015


On 31-Aug-15 02:19 PM, Richard Biener wrote:
> 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.
>
It seems to be a bad optimization for zero overhead loops and/or 
software pipelining. Can it be disabled when these features are available.
Shmeel



More information about the Gcc mailing list