[llvm-dev] Added AllocaInsts are relocated in stack

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 21 02:28:56 PDT 2018


On Thu, 20 Sep 2018 at 21:38, sam djafari via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> I am wondering how I can prevent LLVM from doing re-ordering them, or even reset the AllocaInst numbers, so the newly added AllocaInst can be inserted between the existing and original local variables?

As far as I know you can't. LLVM makes no guarantees about stack
layout at any point.

What you almost certainly need to do is replace the original alloca
with one big enough to contain both the data and the metadata. You can
use ReplaceAllUsesWith directly on the new alloca for the existing
uses, and then your metadata handling would GEP into it before access
to get to the right part.

Cheers.

Tim.


More information about the llvm-dev mailing list