-funsafe-loop-optimizations

Daniel Berlin dberlin@dberlin.org
Sat Jan 1 14:54:00 GMT 2005



On Sat, 1 Jan 2005, Paul Brook wrote:

> On Friday 31 December 2004 21:14, Zdenek Dvorak wrote:
>> Hello,
>>
>> several times some people sounded opinion that in addition to improving
>> analyses in loop optimizer, we might also add a flag that would enable
>> the compiler to assume that the compiled code does not contain loops
>> behaving in "weird" way (loops whose control induction variables
>> overflows, infinite loops with nontrivial exit conditions).
>>
>> I remember several people were against this possibility.  Therefore
>> I send the proposal for the patch implementing this flag first here
>> to the gcc list, to give the chance to discuss about it before I try
>> to test and submit it properly (or not).
>
> Does this apply to all "loops" the compiler discovers, or just where explicit
> source language looping constructs are used. If it's the former we should
> IMHO document this as it's probably not obvious to many users, especially
> when combined with inlining, etc.
>
> Also, is this a property could be annotated on a per-loop basis?

Probably, but we'd have to update a bunch of code to keep it up to date.

xlc tracks the status of the compilation flag on a per-cu basis:

compilation unit options:
     ...
     StrictIVs                 - Assume wrap-around may occur
     ...

and uses an expression flag to tell the simplifier what it can assume 
on a per-expression basis:

expression flags:
     ...
     NonModuloArithmetic  - Assume infinite precision integer arithmetic
     ...


(this flag is only used for telling the expression simplifier what it can 
assume, nothing else)

--Dan



More information about the Gcc mailing list