[LLVMdev] Question About Function Cloning

Arnamoy Bhattacharyya arnamoy at ualberta.ca
Fri Oct 25 09:44:07 PDT 2013


Thanks Tim for the pointer.

Now I am trying to create two global variables, and call functions
with the pointer to them.

Though I can create two global integers, could anyone please tell me
how do I create a pointer to a global variable (not an array) in the
IR?  I know GetElementPtr can be used in case of array but what about
I want a pointer to just an integer and call my function with it?

Sorry, I used to use the LLVM demo page a lot for getting these done,
but now that is down. and also march=cpp does not work for me :-(

Any help will be appreciated.

Thanks a lot;

On Fri, Oct 25, 2013 at 5:35 PM, Tim Northover <t.p.northover at gmail.com> wrote:
> Hi Arnamoy,
>
>> Any idea, why the output looks like -
>
>> Hello World
>> Hello World
>> val is 58
>>
>> While the it should print 4 times?
>
> Both your loops are sharing the counter variable (%i1) without
> resetting it to 0 in between calls. I think that accounts for the
> behaviour.
>
> Cheers.
>
> Tim.
>



-- 
Arnamoy Bhattacharyya
Athabasca Hall 143
Department of Computing Science - University of Alberta
Edmonton, Alberta, Canada, T6G 2E8
587-710-7073



More information about the llvm-dev mailing list