[LLVMdev] Enabling vectorization with LLVM 3.3 for a DSL emitting LLVM IR

Arnold Schwaighofer aschwaighofer at apple.com
Fri Jul 5 09:02:09 PDT 2013

On Jul 5, 2013, at 10:50 AM, Stéphane Letz <letz at grame.fr> wrote:

>>> 2) do you mean *all* "alloca" in a function always have to be in the fist entry block?
>> If you want them converted into ssa variables early on, yes.
> It this documented somewhere?

Sort of, here:


"The mem2reg pass implements the standard “iterated dominance frontier” algorithm for constructing SSA form and has a number of optimizations that speed up (very common) degenerate cases. The mem2reg optimization pass is the answer to dealing with mutable variables, and we highly recommend that you depend on it. Note that mem2reg only works on variables in certain circumstances:

	• mem2reg is alloca-driven: it looks for allocas and if it can handle them, it promotes them. It does not apply to global variables or heap allocations.
	• mem2reg only looks for alloca instructions in the entry block of the function. Being in the entry block guarantees that the alloca is only executed once, which makes analysis simpler.”

More information about the llvm-dev mailing list