[mercury-users] Optimisation of functions and field updates
Julien Fischer
juliensf at csse.unimelb.edu.au
Tue Aug 8 16:22:22 AEST 2006
On Tue, 8 Aug 2006, Julien Fischer wrote:
>
> On Tue, 8 Aug 2006, Julien Fischer wrote:
>
>>
>> On Mon, 7 Aug 2006, Michael Day wrote:
>>
>>> Say I have the following code:
>>>
>>> X = f1(f2(f3(f4(X0))))
>>>
>>> where
>>>
>>> f1(X) = X ^ field1 := blah.
>>> f2(X) = X ^ field2 := blah.
>>> ...
>>>
>>> If the functions were inlined, then the multiple field updates could be
>>> combined into a single update, but it appears that this is not happening,
>>> as I get a speed boost when I replaced the function calls with explicit
>>> field updates, even at -O5.
>>
>> It looks like the simplification passes after inlining aren't cleaning
>> up as well as they should. I've just constructed a small example and
>> it seems to leave redundant assignments hanging around. This seems
>> to be more of a problem in the MLDS backend.
>
> In fact looking at the generated C code more closely it is only
> a problem for the MLDS backnd, the LLDS->LLDS optimizations
> clean up the redundant assignments (at least for my example).
>
That said, gcc *does* clean them up, so I'm at a loss to say what
is happening here.
Julien.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to: mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions: mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the users
mailing list