By ref and by pointer kills performance.
claptrap
clap at trap.com
Tue Feb 13 19:08:21 UTC 2024
On Tuesday, 13 February 2024 at 06:02:47 UTC, Bruce Carneal wrote:
> On Tuesday, 13 February 2024 at 02:11:45 UTC, claptrap wrote:
>>
>
> To reuse the value the compiler would have to prove that the
> memory locations do not overlap. FORTRAN does not have this
> problem, neither does ldc once you take responsibility for
> non-overlap with the @restrict attribute as seen here:
>
> https://d.godbolt.org/z/z9vYndWqP
>
> When loops are involved between potentially overlapping indexed
> arrays I've seen ldc go through the proof and do two versions
> of the code with a branch.
Ah OK makes sense. The restrict attribute will help with what I'm
doing.
thanks.
More information about the Digitalmars-d
mailing list