ldc-developers/ldc — pull request #108 by dansanduleac (2012-06-05 02:01:25+00:00)
Title: Fix #49: Static arrays should be passed using byval

... instead of as chunks of data.

This [example](https://github.com/ldc-developers/ldc/issues/49#issuecomment-6099754) in #49 makes it apparent that compilation of such LLVM assembly into native (tested on x86-64) code 1) takes a really long time and 2) produces a lot of useless mov instructions.

Thus, when a static array is too big to fit into a register (only in the case of x86-64), it should get passed to a function as `[4096 x i8]* byval` (if the array were `char[4096]` in this example).

Phobos unit tests pass, and I've noticed a huge performance boon in some druntime benchmarks (`aabench/string` is now more than 10 times faster).

Haven't tested on anything else than `OS X x86-64 / LLVM 3.0`.