<div dir="ltr">If you always generate a `memcpy` call (intrinsic) instead of load/store to move values around, the resulting machine code will be as you want. (You might add a heuristic that it only uses memcpy for values that are much larger than a register, but LLVM does pretty well regardless)<br><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 29, 2018 at 1:08 PM Bagel via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If a store has a type which is "large", the code generated is loop unrolled.<br>
For example:<br>
<br>
%R = type {i32, [255 x i32]}<br>
@a = global %R zeroinitializer, align 4<br>
define void @foo(%R* %y$) nounwind {<br>
L.0:<br>
        %y = alloca %R*<br>
        store %R* %y$, %R** %y<br>
        %0 = load %R*, %R** %y<br>
        %1 = load %R, %R* %0<br>
        store %R %1, %R* @a<br>
        br label %return<br>
return:<br>
        ret void<br>
}<br>
<br>
generates a huge number of instructions.  Is there a flag somewhere (I couldn't<br>
find one) that which cause this store loop not to be unrolled.<br>
<br>
Thanks, brian<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>