[llvm-commits] PATCH: A new SROA implementation

Duncan Sands baldrick at free.fr
Fri Sep 14 03:07:09 PDT 2012


Hi Chandler,

 >     Above you seem to be assuming that the elements are naturally aligned, 
i.e. have
>     alloc size equal to the size in bits.  I'm not sure that is guaranteed.
>
>
> That's exactly what is guaranteed for vectors?

well, there's a plan to have vectors work that way, but this code is probably
the only part of LLVM that actually computes something based on that, while
everywhere else assumes that for a vector <8 x i24> each i24 is 32 bits apart
(32 = alloc size of i24) rather than 24 bits apart.  I.e. isn't this too early.

>
>     Shouldn't this be EndOffset - 1?  (In which case it should be <= above).
>
>
> No, we're building an end iterator here. We want to be one-past-the-end.

Hrm?  I can understand that you might want the index of the struct field that
is one after the last struct field accessed by the memory range, but your code
won't give it to you if the memory ends halfway through a field.  You can get
it by finding the index of the field containing EndOffset - 1, then adding 1
to that index.

Ciao, Duncan.



More information about the llvm-commits mailing list