<div dir="ltr"><div>In my compiler, I wrote code to always put alloca at the entry of a function (basically, "figure out current function, find first basic block, insert alloca into the bb"). <br><br>Is this for your own compiler, for clang, or something other use? [I was under the impression that clang did this too, but I may be wrong]<br><br>--<br></div>Mats<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 5 January 2017 at 16:47, Johnson, Nicholas Paul 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">Is there an existing LLVM pass which moves alloca instructions into the function entry block?  In particular, I am seeing an alloca which is ideal for this movement: the alloca is not in the function entry block, it allocates a constant size, it is *not* within a loop, and it is in a block which post-dominates the function entry (i.e., it invariably executes with every function invocation).<br>
<br>
I think this movement normally happens as during the function inlining process.  I'm not sure why it hasn't occurred in this case, but whatever the reason, the poor alloca placement inhibits later optimizations, especially SROA, so I would like to fix it.<br>
<br>
Nick Johnson<br>
D. E. Shaw Research<br>
<br>
<br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">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/<wbr>mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br></div>