Thanks a lot. That worked.<div><br></div><div>Arushi<br><br><div class="gmail_quote">On Tue, Feb 22, 2011 at 2:43 PM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com">clattner@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im"><br>
On Feb 22, 2011, at 11:46 AM, John Criswell wrote:<br>
<br>
> On 2/22/11 1:31 PM, Arushi Aggarwal wrote:<br>
>> Hi,<br>
>><br>
>> I want to clone a given function, and add an argument to it. I then<br>
>> want to add a call to that new function. I have a callInstruction CI,<br>
>> which I want to transform to call this new function, and to take a new<br>
>> argument.<br>
><br>
> If I understand correctly, you're cloning the function first and then<br>
> adding a new argument to the clone.  Do I understand correctly?<br>
><br>
> If so, I don't believe you can do that.  IIRC, you have to first create<br>
> a new, empty function with the additional argument and then use<br>
> CloneFunctionInto() to clone the body of the original function into the<br>
> new function.  I believe that's what poolalloc does and what I did the<br>
> last time I had to add function arguments to a function.<br>
<br>
</div>Right, you can also take a look at the dead argument elimination or argument promotion passes for examples.<br>
<font color="#888888"><br>
-Chris</font></blockquote></div><br></div>