[cfe-dev] struct copy
akyrtzi at gmail.com
Sun Sep 28 04:59:02 PDT 2008
Chris Lattner wrote:
> In theory, it should be safe and fast for the compiler to always
> produce a memcpy and then let the backend lower it however it wants.
What is wrong with having the compiler always produce a load/store ?
%tmp = load %struct.S* %q1
store %struct.S %tmp, %struct.S* %q2
conveys the information "take a value of type %struct.S from here and
store it there."
Having a memcpy:
call void @llvm.memmove.i32(i8* %tmp, i8* %tmp1, i32 12, i32 4)
conveys the information "copy 12 bytes from here to there", which is a
lowered form of load/store.
It's very easy to lower load/store to memcpy, going the other way around
is not so easy.
More information about the cfe-dev