[llvm-dev] Added AllocaInsts are relocated in stack

sam djafari via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 21 06:05:16 PDT 2018


Hi Tim,

Thanks for your reply. However, I have seen that addressSanitizer has done
this by placing redzones around each local variable. But i have not figured
out yet how they have done it, I was wondering if there is a switch or a
method by which I can reset the slotNumbering given to each instruction. By
doing so, LLVM would place them in the expected order I guess.

Best regards,
Saman

On Fri, Sep 21, 2018 at 5:29 AM Tim Northover <t.p.northover at gmail.com>
wrote:

> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180921/4ed04e58/attachment.html>


More information about the llvm-dev mailing list