about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-08-06 08:09:59 +0000
committerbors <bors@rust-lang.org>2017-08-06 08:09:59 +0000
commita9c24fd579cfa08852dca94214caae4b7e6b91c1 (patch)
tree32126d8fc5afedad4033af072b1df6d5f0e3ae3b /src/libsyntax
parentdd1df35f87beca7b1768b3e8fc3569dd8f9009e5 (diff)
parent11d6312abd614fca3970902f137225e0437d0a09 (diff)
downloadrust-a9c24fd579cfa08852dca94214caae4b7e6b91c1.tar.gz
rust-a9c24fd579cfa08852dca94214caae4b7e6b91c1.zip
Auto merge of #43488 - Florob:repeat-opt, r=arielb1
Optimize initialization of arrays using repeat expressions

This PR was inspired by [this thread](https://www.reddit.com/r/rust/comments/6o8ok9/understanding_rust_performances_a_newbie_question/) on Reddit.
It tries to bring array initialization in the same ballpark as `Vec::from_elem()` for unoptimized builds.
For optimized builds this should relieve LLVM of having to figure out the construct we generate is in fact a `memset()`.

To that end this emits `llvm.memset()` when:
* the array is of integer type and all elements are zero (`Vec::from_elem()` also explicitly optimizes for this case)
* the array elements are byte sized

If the array is zero-sized initialization is omitted entirely.
Diffstat (limited to 'src/libsyntax')
0 files changed, 0 insertions, 0 deletions