<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Oct 19, 2016 at 2:52 PM, Nuno Lopes via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Memcpy does a byte-by-byte copy. So if one of the bits is poison then only the byte containing that bit becomes poison.<br>
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.<br>
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.<br>
So the hope is that there's no diff at assembly level.<br></blockquote><div><br></div><div>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?</div><div><br></div></div></div></div>