[LLVMdev] global variable

John Criswell jtcriswel at gmail.com
Wed Mar 4 19:48:57 PST 2015


On 3/4/15 10:13 PM, Yuxi Chen wrote:
> Hi all,
>
> I am newbie for llvm.  I just create a global variable, there are some 
> statements in my pass like:
>
>     LoadInst* int64_64 = new LoadInst(pthreadPID, "", false, OptAplusOne);
>     int64_64->setAlignment(8);
>
>     int64_64->dump();
>     LoadInst* int32_65 = new LoadInst(gvar_int32_myFlag, "", false, 
> OptAplusOne);
>     int32_65->setAlignment(4);
>
>     int32_65->dump();
>
> But when I run my pass,  it generates an error, I don't know why.
>
> @myFlag = global i32 0, align 4
> @myPid = common global [20 x i64] zeroinitializer, align 16 //this is 
> the global,
>   %117 = load i64* %t, align 8
>   %118 = load i32* @myFlag, align 4
> While deleting: i32* %myFlag
> Use still stuck around after Def is destroyed:@myFlag = global i32 
> <null operand!>, align 4
>
> I am sure I initialize the global variable myFlag, I don't delete this 
> global variable.
>
> Can anyone give some hints, or suggestions?

What code is printing the "While deleting:" text?  Is it your code that 
prints that, or is it some existing LLVM pass?

It looks like something is trying to remove the myFlag global variable, 
but I don't know what code is trying to do that.  I suggest you find 
that code and figure out why it's trying to remove a global variable 
that you're still using.

Regards,

John Criswell

>
> Yuxi
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell

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


More information about the llvm-dev mailing list