Prevent optimization from tempering with unsafePerformIO

David Sabel sabel at ki.informatik.uni-frankfurt.de
Wed Oct 17 05:07:37 EDT 2007


Hi Bernd,

Bernd Brassel wrote:
> Hi David,
>
> thank you! This is really useful information!
>
>   
>> I think it's the let floating (out) together with common subexpression 
>> elimination:
>>
>>  > ghc --make -O2 -no-recomp -fno-cse  -o curry-no-cse  curry.hs
>> [1 of 1] Compiling Main             ( curry.hs, curry.o )
>> Linking curry-no-cse ...
>>  > ghc --make -O2 -no-recomp -fno-full-laziness  -o curry-no-fll  curry.hs
>> [1 of 1] Compiling Main             ( curry.hs, curry.o )
>> Linking curry-no-fll ...
>>  > ghc --make -O2 -no-recomp -fno-full-laziness -fno-cse  -o 
>> curry-no-cse-no-fll  curry.hs
>> [1 of 1] Compiling Main             ( curry.hs, curry.o )
>> Linking curry-no-cse-no-fll ...
>>  > ./curry-no-cse
>> 3 possibilities: [True,False]
>> 2 possibilities: [True,False]
>>  > ./curry-no-fll
>> 3 possibilities: [True,False]
>> 2 possibilities: [True,False]
>>  > ./curry-no-cse-no-fll
>> 3 possibilities: [True,True,False]
>> 2 possibilities: [True,False]
>>     
>
> I will try this on large scale Curry programs. I hope the remaining
> optimizations will still do some good. Do you think that there is a way
> to be more selective? I mean to select those parts of the program which
> can and which cannot be optimized?
>   
I think this would require an analysis of the code during compilation 
(to split into "pure" parts and "impure" parts),
but we did not investigate this.

>   
>> ps.: Maybe it is interesting to look at HasFuse [1] (somewhat outdated), 
>> but it exactly forbids both transformations
>>
>> [1] http://www.ki.informatik.uni-frankfurt.de/research/diamond/hasfuse/
>>     
>
> Yes, that looks interesting, too. Are there plans to update it with the
> ghc?
>   
Honestly, we did nothing since 2004 on the code, but maybe we could port 
the changes to the current source of ghc.

I remember that in an early version of ghc (I think < 5) there was an option
 -O file which gave the user control over the optimizations with a script,
this would probably a nice feature to have again...

Regards,
 David
> Thanks for your hints!
> Bernd
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>   



More information about the Glasgow-haskell-users mailing list