[rust-dev] Integer overflow, round -2147483648

Huon Wilson dbau.pp at gmail.com
Mon Jun 23 01:07:01 PDT 2014


On 23/06/14 14:46, comex wrote:
> On Mon, Jun 23, 2014 at 12:35 AM, Daniel Micay <danielmicay at gmail.com> wrote:
>> An operation that can unwind isn't pure. It impedes code motion such as
>> hoisting operations out of a loop, which is very important for easing
>> the performance issues caused by indexing bounds checks. LLVM doesn't
>> model the `nounwind` effect on functions simply for fun.
> No it doesn't!  Or maybe it does today, but an unwindable operation is
> guaranteed to be repeatable without consequence, which I'd like to
> think can account for most cases where operations are hoisted out of
> loops (again, could be wrong :), and not to modify any memory (unless
> it traps, but in Rust at that point you are guaranteed to be exiting
> the function immediately).
>

I would think that something simple like

   let mut sum = 0;
   for x in some_int_array.iter() {
       sum += x;
   }

would be very hard to vectorise with unwinding integer operations.


Huon


More information about the Rust-dev mailing list