bounds checking and optimization
Bruce Carneal
bcarneal at gmail.com
Wed Jun 30 01:18:53 UTC 2021
On Tuesday, 29 June 2021 at 11:20:19 UTC, Johan wrote:
> On Sunday, 27 June 2021 at 17:49:22 UTC, Bruce Carneal wrote:
>> [snip]
> [snip]
>
> This means that we can solve it by reordering/optimizing our
> optimization pipeline in LDC. It is non-trivial work and I
> would suggest not to undertake it before we have switched to
> LLVM's new PassManager (because I think that also tweaks the
> order of optimization passes)
>
> -Johan
Thanks for the update Johan. I'll keep working with the "manual"
version, @trusted and .ptr, and watch for any updates. You guys
seem pretty busy already so I hope it fits in with your other
work.
A related question: is there anything preventing the compiler
from lifting range checks out of loops and throwing early? For
example, on something like:
foreach(i, ref dst; c[])
dst = a[i] + b[i];
could c.length be extracted and asserted as being leq a.length
and b.length before we drop in to the loop?
Finally, it seems like bounds checking optimizations of this sort
belong in the front end or am I mistaken?
More information about the digitalmars-d-ldc
mailing list