[llvm-dev] RFC: Killing undef and spreading poison

Bruce Hoult via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 19 05:44:05 PDT 2016


On Wed, Oct 19, 2016 at 2:52 PM, Nuno Lopes via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Memcpy does a byte-by-byte copy. So if one of the bits is poison then only
> the byte containing that bit becomes poison.
> Therefore, memcpy(x, y, 1) is equivalent to load i8.  But memcpy(x,y,4) is
> not equivalent to "load i32" since load makes the whole value poison if any
> of the bits is poison.
> The alternative as given by Eli is to use "load <4 x i8>".  Since now we
> are loading 4 separate values, poison does not extend past the byte
> boundary.  When load is lowered, you should get exactly the same code as
> with "load i32", though.
> So the hope is that there's no diff at assembly level.
>

I'm curious. Where is it defined that memcpy is byte by byte not, for
example, bit by bit? Why is the destination not identical to the source,
with exactly the same bits poison?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161019/5bbc9478/attachment.html>


More information about the llvm-dev mailing list