I made a GlobalVariable that is of type ConstantArray. For one of it's elements I assigned it the ConstantExpr::getBitCast of another GlobalVariable(the "shadow pointer" mentioned). This gives me: While deleting: i32 (i32)** %Shadow Variable for ptr1 Use still stuck around after Def is destroyed:i8* bitcast (i32 (i32)** @"Shadow Variable for ptr1" to i8*) opt: Value.cpp:75: virtual llvm::Value::~Value(): Assertion `use_empty() && "Uses remain when a value is destroyed!"' failed. I only see this after my Pass' runOnModule() method is done. I'm not sure what I'm doing wrong, this seems like a legitimate actions. I also cant come up with another way to do this. Any advice? Thank you
Tanya Lattner
2011-Oct-26 20:42 UTC
[LLVMdev] Use still stuck around after Def is destroyed:
On Oct 26, 2011, at 12:18 PM, ret val wrote:> I made a GlobalVariable that is of type ConstantArray. For one of it's > elements I assigned it the ConstantExpr::getBitCast of another > GlobalVariable(the "shadow pointer" mentioned). This gives me: > > While deleting: i32 (i32)** %Shadow Variable for ptr1 > Use still stuck around after Def is destroyed:i8* bitcast (i32 > (i32)** @"Shadow Variable for ptr1" to i8*) > opt: Value.cpp:75: virtual llvm::Value::~Value(): Assertion > `use_empty() && "Uses remain when a value is destroyed!"' failed. > > I only see this after my Pass' runOnModule() method is done. I'm not > sure what I'm doing wrong, this seems like a legitimate actions. I > also cant come up with another way to do this. >Are you saying that a dead ConstantExpr that uses the Global is hanging around when you try to delete it? If so, use removeDeadUsersOfConstant() on the Global before you try to remove it. If the use is not dead, then you can't remove the GlobalVar. -Tanya> Any advice? > Thank you > _______________________________________________ > 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/20111026/c91a9dc0/attachment.html>
Tanya Lattner
2011-Oct-26 20:43 UTC
[LLVMdev] Use still stuck around after Def is destroyed:
On Oct 26, 2011, at 1:42 PM, Tanya Lattner wrote:> > On Oct 26, 2011, at 12:18 PM, ret val wrote: > >> I made a GlobalVariable that is of type ConstantArray. For one of it's >> elements I assigned it the ConstantExpr::getBitCast of another >> GlobalVariable(the "shadow pointer" mentioned). This gives me: >> >> While deleting: i32 (i32)** %Shadow Variable for ptr1 >> Use still stuck around after Def is destroyed:i8* bitcast (i32 >> (i32)** @"Shadow Variable for ptr1" to i8*) >> opt: Value.cpp:75: virtual llvm::Value::~Value(): Assertion >> `use_empty() && "Uses remain when a value is destroyed!"' failed. >> >> I only see this after my Pass' runOnModule() method is done. I'm not >> sure what I'm doing wrong, this seems like a legitimate actions. I >> also cant come up with another way to do this. >> > > Are you saying that a dead ConstantExpr that uses the Global is hanging around when you try to delete it? > > If so, use removeDeadUsersOfConstant() on the Global before you try to remove it. >Sorry, I mean removeDeadConstantUsers ( ) -Tanya> If the use is not dead, then you can't remove the GlobalVar. > > -Tanya > >> Any advice? >> Thank you >> _______________________________________________ >> 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/20111026/d0401bfb/attachment.html>
No, I am not trying to delete anything. I wanted to created a GlobalVariable that is of Type ConstantArray, where one of the elements its a BitCast of a GlobalVariable. I have that, but I get those errors after my pass is done. I dont know why, my code seems sane enough, and I dont know another way I can go about this. On Wed, Oct 26, 2011 at 4:42 PM, Tanya Lattner <lattner at apple.com> wrote:> > On Oct 26, 2011, at 12:18 PM, ret val wrote: > > I made a GlobalVariable that is of type ConstantArray. For one of it's > elements I assigned it the ConstantExpr::getBitCast of another > GlobalVariable(the "shadow pointer" mentioned). This gives me: > > While deleting: i32 (i32)** %Shadow Variable for ptr1 > Use still stuck around after Def is destroyed:i8* bitcast (i32 > (i32)** @"Shadow Variable for ptr1" to i8*) > opt: Value.cpp:75: virtual llvm::Value::~Value(): Assertion > `use_empty() && "Uses remain when a value is destroyed!"' failed. > > I only see this after my Pass' runOnModule() method is done. I'm not > sure what I'm doing wrong, this seems like a legitimate actions. I > also cant come up with another way to do this. > > > Are you saying that a dead ConstantExpr that uses the Global is hanging > around when you try to delete it? > If so, use removeDeadUsersOfConstant() on the Global before you try to > remove it. > If the use is not dead, then you can't remove the GlobalVar. > -Tanya > > Any advice? > Thank you > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >
Maybe Matching Threads
- [LLVMdev] Use still stuck around after Def is destroyed:
- [LLVMdev] Use still stuck around after Def is destroyed:
- [LLVMdev] differences in IR and ELF?
- [LLVMdev] A way to pass const char* arg without creating a GlobalVariable
- [LLVMdev] A way to pass const char* arg without creating a GlobalVariable