[LLVMdev] Quick doubt about IR

Jim Grosbach grosbach at apple.com
Wed Dec 4 13:57:35 PST 2013


Create a new alloca instruction, insert it into the IR right before (or after) the old one, RAUW the value, then delete the old instruction. You should be able to find a variety of examples of this sort of thing in most of the IR level optimization passes. I’d look at InstCombine in particular.

-Jim

On Dec 4, 2013, at 1:40 PM, Shivam Bhagi <shivam.bhagi at outlook.com> wrote:

> Hi,
> 
> While looking over the IR generated by my source code, I came across the following:
> 
> %arr = alloca [30 x i8], align 1
> 
> In the source code this particular line of code is represented by:
> 
> int arr[30];
> 
> I was wondering how I could change the capacity of arr from 30 to any other integral value via a function-pass. I know that 'alloca' can be used for reserving space on stack; further, 'store' can be used for writing to memory. I was wondering how that would work for an array though?
> 
> Thanks,
> Shivam
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131204/288e6f50/attachment.html>


More information about the llvm-dev mailing list