[llvm-dev] A pass which moves AllocaInst into function entry block?

Johnson, Nicholas Paul via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 5 08:47:51 PST 2017


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).

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.

Nick Johnson
D. E. Shaw Research




More information about the llvm-dev mailing list